I have a class that looks something like this:
public myArguments
{
public List<string> argNames {get; set;}
}
In my test I'm doing this:
var expectedArgNames = new List<string>();
expectedArgNames.Add("test");
_mockedClass.CheckArgs(Arg.Any<myArguments>()).Returns(1);
_realClass.CheckArgs();
_mockedClass.Received().CheckArgs(Arg.Is<myArguments>(x => x.Equals(expectedArgNames));
But the test fails with this error message:
NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching:
CheckArgs(Foo[])
Actually received no matching calls.
Received 1 non-matching call (non-matching arguments indicated with '*' characters):
CheckArgs(*myArguments*)
I'm guessing it's because of the .Equals()
but I'm not sure how to solve it?
Aucun commentaire:
Enregistrer un commentaire