MockMockedInstance Property

Typemock Isolator Developer Guide
Get the actual instance that is being mocked and controlled. This enables tracking instance mocks to the actual instance

Namespace:  TypeMock
Assembly:  TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax

public Object MockedInstance { get; }

Return Value

Type: Object
Mock Instance
Remarks

Being able to reference the mocked instance enables testing fields of future object. Example of using Typemock Isolator to test a field of a future object
Examples

   public static void CreateAnObject()
   {
    TestClass theClass = new TestClass();
    theClass.field = 5;
    ...
}
[Test]
   public void VerifyFutureObject()
   {
       //Create new Mock for a future Object, no expectations 
       Mock mock = MockManager.Mock(typeof(TestClass));

       // Call our code
    TheClass.CreateAnObject();

    // get the mocked object and test the field
    TestClass theClass = mock.MockedInstance as TestClass;
    Assert.AreEqual(5, theClass.field);

       // Verify that all the expected calls have actually been called.
       MockManager.Verify();
}
See Also

Reference