Hi,
that's a failing example:
public interface IMyObject
{
}
public interface IMyInterface
{
IMyObject MyObject { get; }
}
[Test]
public void TestFoo()
{
MockManager.Init();
MockObject mockMyInterface = MockManager.MockObject(typeof (IMyInterface));
mockMyInterface.ExpectGet("MyObject", null);
IMyInterface myObj = (IMyInterface) mockMyInterface.Object;
Assert.IsNull(myObj.MyObject);
MockManager.Verify();
}
When I try to run the test, I receive the following error:
TypeMock.TypeMockException:
*** Method get_MyObject in type IMyInterface has no matching overload that returns TypeMock.Mock+a.
More interesting, if I try to use Mock instead of MockObject, I receive another error message, maybe more strange than the first the one. That's the code:
[Test]
public void TestFoo()
{
MockManager.Init();
Mock mockMyInterface = MockManager.Mock(typeof (IMyInterface)); //<< error message points here
mockMyInterface.ExpectGet("MyObject", null);
MockManager.Verify();
}
And that's the error message:
TypeMock.TypeMockException:
*** Cannot type mock Interfaces or Abstract classes use MockObject
Waiting for your feedback,
Thanks,
Deimos