There is a broken case in Typemock 5.3.1 relating to how WasNotCalled is used in conjunction with DateTime.Now as an argument.
Here's the production code:
public class SmallBridge
{
public void RunInsert(DateTime dt)
{
}
public void AStringInsert(string str)
{
}
}
And here's the test code:
[TestFixture, ClearMocks]
public class TypemockTest
{
public TypemockTest()
{
}
[Test, Isolated]
public void MeanCase1()
{
SmallBridge aBridge = Isolate.Fake.Instance<SmallBridge>(Members.CallOriginal);
Isolate.Verify.WasNotCalled(()=>aBridge.RunInsert(DateTime.Now));
}
[Test, Isolated]
public void MeanCase2()
{
SmallBridge aBridge = Isolate.Fake.Instance<SmallBridge>(Members.CallOriginal);
Isolate.Verify.WasNotCalled(() => aBridge.AStringInsert(string.Empty));
}
}
MeanCase2 passes but MeanCase1 fails with the below message:
TestCase 'MeanCase1'
failed: TypeMock.TypeMockException :
*** Cannot use Isolate.Verify on a static method without first setting static method behavior using Isolate.Fake.StaticMethods()
at dz.a()
at cy.a(Delegate A_0)
at cy.c(Delegate A_0)
at cy.a(Action A_0)
C:developmentEsteem7 .Net2PostProtect2UnitTestTypemockTest.cs(39,0): at PostProtect2UnitTest.TypemockTest.MeanCase1()
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
C:developmentEsteem7 .Net2PostProtect2UnitTestTypemockTest.cs(0,0): at PostProtect2UnitTest.TypemockTest.MeanCase1()
Typemock 5.3.0 doesn't have this problem.