You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example the problem occurs because int implicitly casts to double, but NSubstitute doesn't pick up the argument matcher as the types diff (changing that opens a can of worms IIRC). I think that that when Returns runs the "any int" matcher is discarded; instead it should throw as the call has not been specified correctly.
public interface IFoo {
int Blah(double s);
}
[Test]
public void NSubRepro()
{
var foo = NSubstitute.Substitute.For<IFoo>();
foo.Blah(Arg.Any<int>()).Returns(42);
Assert.AreEqual(42, foo.Blah(10));
/* FAILS:
Expected: 42
But was: 0 */
}
The text was updated successfully, but these errors were encountered:
In this example the problem occurs because
int
implicitly casts todouble
, but NSubstitute doesn't pick up the argument matcher as the types diff (changing that opens a can of worms IIRC). I think that that whenReturns
runs the "any int" matcher is discarded; instead it should throw as the call has not been specified correctly.The text was updated successfully, but these errors were encountered: