After upgrading to NCrunch 3.13.0.7, I'm getting regular occurrences of an UnexpectedArgumentMatcherException. They're occurring at most once per test run, and the exception message is like this:
Quote:SetUp : NSubstitute.Exceptions.UnexpectedArgumentMatcherException : Argument matchers (Arg.Is, Arg.Any) should only be used in place of member arguments. Do not use in a Returns() statement or anywhere else outside of a member call.
Correct use:
sub.MyMethod(Arg.Any<string>()).Returns("hi")
Incorrect use:
sub.MyMethod("hi").Returns(Arg.Any<string>())
Re-running the test always clears the exception.
However, none of my tests use Arg.Any inside a Returns method call. An example line that produces this exception is
Code:
_mockDateTimeProvider.UtcNow.Returns(_defaultDateTime);
where _mockDateTimeProvider is an object created by AutoFixture, and _defaultDateTime is a static DateTime object.
Is there perhaps something else causing these exceptions, or is this an issue in the 3.13.0.7 version of NCrunch?
Thanks!