If I have:
public class TestClass
{
public void Method1(object data)
{
var otherClass = UnityContainer.Resolve(data) as OtherClass;
var result = otherClass.Method2();
}
}
And I want to run the actual implementation of OtherClass rather than mocking it using:
var testClass = new Mock<TestClass>() { CallBase = true }
(I'm writing dependency injection tests)
Is there a way that I can test the return value of OtherClass().Method2()?
Specifically, I want to do:
var testClass1 = new Mock<TestClass>() { CallBase = true }
var testClass2 = new Mock<TestClass>() { CallBase = true }
Assert.Same(resultOfTestClass1OtherClassMethod2, resultOfTestClass2OtherClassMethod2)
to check that I'm returning the same instance, and I've got things set up correctly in Unity.
Any helpers out there?