Hi TypeMock
I am trying to make a mocked version of ExampleClass, that when calling a mocked version of A() will call the mocked version of B():
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TypeMock.ArrangeActAssert;
namespace TestProject1
{
public class ExampleClass
{
public void A()
{
throw new Exception("A Original");
}
public void B()
{
throw new Exception("B Original");
}
}
[TestClass]
public class UnitTest1
{
[TestMethod]
[Isolated]
public void TestMethod1()
{
var e = Isolate.Fake.Instance<ExampleClass>();
Isolate.WhenCalled(() => e.B()).WillThrow(new Exception("B Mocked"));
Isolate.WhenCalled(() => e.A()).
DoInstead(context =>
{
e.B();
});
e.A();
}
}
}
The test throws "B Original", but i would excpect it to throw "B Mocked"? Are my expectations wrong? or is it a bug? I am using the latest version of TypeMock Isolator (5.3.1) on the .NET 3.5 platform.