heres a test that fails:
public class UsedClass
{
public int multiply(int a)
{
return a * 3;
}
}
public class ClassUnderTest
{
private UsedClass _GetUsed;
public UsedClass getUsed
{
get { return _GetUsed; }
}
public ClassUnderTest()
{
_GetUsed = new UsedClass();
}
}
[TestClass]
public class ConditionalChaining
{
[TestMethod]
public void ConditionalChaining_OnSameCall_throwsException()
{
ClassUnderTest target = new ClassUnderTest();
Isolate.WhenCalled(() => target.getUsed.multiply(0)).WillReturn(20);
Isolate.WhenCalled(() => target.getUsed.multiply(5)).WithExactArguments().WillReturn(3);
Assert.AreEqual(3, target.getUsed.multiply(5));
Assert.AreEqual(20, target.getUsed.multiply(20));
Assert.AreEqual(20, target.getUsed.multiply(56));
}
}
but passes if switch the whencalled statements like this:
[TestMethod]
public void ConditionalChaining_OnSameCall_throwsException()
{
ClassUnderTest target = new ClassUnderTest();
Isolate.WhenCalled(() => target.getUsed.multiply(5)).WithExactArguments().WillReturn(3);
Isolate.WhenCalled(() => target.getUsed.multiply(0)).WillReturn(20);
Assert.AreEqual(3, target.getUsed.multiply(5));
Assert.AreEqual(20, target.getUsed.multiply(20));
Assert.AreEqual(20, target.getUsed.multiply(56));
}
any idea why?