Just use MockManager.Mock() :)
There is a difference between MockManager.
Mock and
MockObject.
:arrow: The MockObject creates a
new object that
implements an interface (This is your regular mock, like nMock)
:arrow: The Mock will Mock the
next (or all) instances of a concrete class.
So to mock a concrete class do the following:
// set up the next instance of Cart to be mocked
Mock mock = MockManager.Mock(typeof(Cart));
// set up expectations...
mock.ExpectAndReturn("Method",5);
// Create a new Cart - this will be mocked
Cart thisIsAMockedCart = new Cart(); // no need to do mock.Object
// TypeMock is clever enough to insert your expectations
// into this Cart object, it listens to 'new' statments and
// returns a mock instance (Wow!)
// now if we call Method it will return 5 (our mock)
:idea: Perhaps
MockAll will be clearer. MockAll mocks all objects of the mocked type
// set up all Cart objects to be mocked
Mock mock = MockManager.MockAll(typeof(Cart));
// Create a new Cart - this will be mocked
Cart thisIsAMockedCart = new Cart(); // no need to do mock.Object
Perhaps the names are confusing
-MockObject should be called MockInterface as it mocks interfaces and abstract classes and creates an object
-Mock should be called MockTheNextInstanceOf.
We have spent a lot of resources on documenting TypeMock, you can find lots of comprehensive information there, Plus there are some articles on this site.