I'm experiencing an issue where tests are succeeding on my local machine using visual studio but they will fail when my CI Build runs them on my TFS server.
Here's the line that is failing and the preceding line for context.
var mockEventRepository = Substitute.For<IEventRepository>();
mockEventRepository.GetAll().ReturnsForAnyArgs(r => new List<Event>().AsQueryable());
Note that there are NO ARGUMENT MATCHERS! Not a single one in the entire test.
TFS will give the error:
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.
In a nutshell the errors seem to be consistent (the same error) when they're occurring, but they also will seemingly randomly occur or not occur.
For instance... It just succeeded after queuing a subsequent identical build after the original one failed. That time however it failed when it tried the same build with a different configuration with a different but similar and erroneous error:
NSubstitute.Exceptions.AmbiguousArgumentsException : Cannot determine argument specifications to use.
FYI Using TFS 2015 and VS 2015.