Hi Team,
We are upgrading Typemock from version 8.4 to version 8.6(TypemockIsolatorSuite-8.6.0.10.921967232). I got an exception in one of the test,
Please find the following code snippet simplifies and illustrates the issue
Sample C#.Net Code
public enum Enum1
{
test1 = 1,
test2 = 2,
test3 = 3
}
public class Class1
{
private Class2 _c2;
public Class1(Class2 c2)
{
_c2 = c2;
}
public void Method1()
{
Enum1? enumboj;
_c2.TestMtd("Testing", out enumboj);
}
}
public class Class2
{
public void TestMtd(string test, out Enum1? enumboj)
{
enumboj = null;
if (test == "test1")
{
enumboj = Enum1.test1;
}
else if (test == "test2")
{
enumboj = Enum1.test2;
}
}
}
Typemock UnitTest Code
[TestClass]
public class UnitTest1
{
[TestInitialize]
public void MyTestInitialize()
{
MockManager.Init();
}
[TestMethod]
public void TestMethod1()
{
Class2 c2 = Isolate.Fake.Instance<Class2>();
Class1 obj = new Class1(c2);
Enum1? enumboj;
Isolate.WhenCalled(() => c2.TestMtd("test1", out enumboj)).DoInstead(context =>
{
context.Parameters[1] = enumboj = Enum1.test1;
});
obj.Method1();
}
}
In the above code, the second parameter I am passing is of nullable enum type. Below exception occurred.
The same code is working fine in TypeMock Version 8.4. Please help us to resolve in Typemock 8.6 Version.