chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I am using 5.1.2.0. Test case 1 works and the equivalent test case using AAA api fails. What am I doing wrong? TIA

[Test]
[ClearMocks]
public void This_Works()
{
var p = new PatientPaymentBLL();
using(var re =new RecordExpectations())
{
re.ExpectAndReturn(p.ObjectState, Shared.ObjectState.Unchanged);
}
Assert.AreEqual(p.ObjectState,Shared.ObjectState.Unchanged);
}


[Test]
[Isolated]
public void This_Causes_TypeMockException()
{
var p = new PatientPaymentBLL();
Isolate.WhenCalled(()=>p.ObjectState).WillReturn(Shared.ObjectState.Unchanged);
Assert.AreEqual(p.ObjectState, Shared.ObjectState.Unchanged);
}


failed: TypeMock.TypeMockException :
*** No method with name .ctor>b__2 in type MediaHighway.Common.BLL.Financial.PatientPaymentBLL exists.
at cz.b(Type A_0, String A_1)
at cz.c(Type A_0, String A_1)
at TypeMock.Mock.a(String A_0, Object A_1, Boolean A_2, Boolean A_3, Int32 A_4, Type[] A_5)
at TypeMock.Mock.a(String A_0, Object A_1, Boolean A_2, Boolean A_3, Type[] A_4)
at TypeMock.Mock.AlwaysCallOriginal(String method, Type[] genericTypes)
at TypeMock.MockManager.b(Mock A_0, BindingFlags A_1)
at TypeMock.MockManager.b(Object A_0, String A_1)
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)
at MediaHighway.Common.BLL.ORMapping.EntityBase.get_ObjectState()
C:DevP5srcCommon.BLL.TestFinancialPatientPaymentBLLTests.cs(239,0): at MediaHighway.Common.BLL.Test.Financial.PatientPaymentBLLTests.<>c__DisplayClass24.<This_Causes_TypeMockException>b__23()
at TypeMock.ArrangeActAssert.IsolatedAttribute.Execute()
at TypeMock.DecoratorAttribute.CallDecoratedMethod()
at TypeMock.ArrangeActAssert.IsolatedAttribute.Execute()
at TypeMock.MethodDecorator.a()
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:DevP5srcCommon.BLL.TestFinancialPatientPaymentBLLTests.cs(0,0): at MediaHighway.Common.BLL.Test.Financial.PatientPaymentBLLTests.This_Causes_TypeMockException()
asked by MBeckius (5.4k points)

1 Answer

0 votes
Hi,

This seems like a bug :(. Can you post the code for the PatientPaymentBLL class? It seems like there's a problem handling an anonymous delegate on that class - is there one define in one of its methods?

Thanks,
Doron Peretz
Typemock Support
answered by doron (17.2k points)
...