chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Hi, everybody

Could anybody tell me what's the exactly difference between MockObject.Object and Mock.MockedInstance, and any sample?
It seems that they both return the mocked object, as I'm really confused.

The following documentation described in Typemock Isolator help.chm
Get the Mocked Object
Get the actual instance that is being mocked and controlled.
This enables tracking instance mocks to the actual instance

thanx in advanced.

asked by won.wingcrown@gmail. (1.1k points)

2 Answers

0 votes
Hi Chris,

They are basically the same, but it makes more sense if you understand the difference between Mock and MockObject. You can read more about mock objects here. Then depending on the usage, you should use the appropriate property.

The short story is this: MockObject creates an instance, which is returned through the Object property. Mock attaches to a future instance when it is created. The reference to this instance is through the MockedInstance property. Before it is created, the property value is null, by the way.

In the new Arrange-Act-Assert API, we've abandoned this interface, and therefore it's less confusing. Have a look at the different posts about AAA here.

answered by gilz (14.5k points)
0 votes
Thank you for your reply. :)
answered by won.wingcrown@gmail. (1.1k points)