I was wondering if there is a way to populate parameter, that is for example List from mocked method, if you use NMock3 library.
So I have method in object that I want to mock, with this signature:
int Method1(List people);
In it's body, method is adding strings into list and return error code. This method is from C dll, so I created wrapper for this method in order to test the code that is using this method. But when I try to mock method like this:
List<string> response = new List<string>() {"one"};
adapterMock.Expects.One.Method(x => x.Method1(emptyList))
.WithAnyArguments()
.Will(new SetIndexedParameterAction(0, response), Return.Value(0));
list that I send to method remain empty. Is there a way with NMock to add some values to list, or array, that is sent to method as parameter?
Aucun commentaire:
Enregistrer un commentaire