Geeks With Blogs
Etienne Giust's .NET notes Some .NET tips and tricks for me to remember. That might help you too June 2012 Entries
Rhino Mocks, AssertWasCalled with Arg Constraint on array parameter
Today, I had a hard time unit testing a function to make sure a Method with some array parameters was called. Method to be called : void AddUsersToRoles(string[] usernames, string[] roleNames); I had previously used Arg<T>.Matches on complex types in other unit tests, but for some reason I was unable to find out how to apply the same logic with an array of strings. It is actually quite simple to do, T really is a string[], so we use Arg<string[]>. As for the Matching part, a ToList() ......

Posted On Sunday, June 3, 2012 10:35 PM

Copyright © Etienne Giust | Powered by: