Mock is the Typemock Isolator mock type controller, this class is use for managing the
            virtual mocks
            
Inheritance Hierarchy
TypeMockMock
TypeMockMockObject
Namespace: TypeMock
Assembly: TypeMock (in TypeMock.dll) Version: 9.3.8.0 (9.3.8.0)
Syntax
The Mock type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| Mock | 
            Constructer, keep internal
              | 
Properties
| Name | Description | |
|---|---|---|
| CallBase | ||
| CallStatic | 
            Allow mocking a static method when that method is overloaded with an instance method
             Remarks  | |
| MockedInstance | 
             Get the actual instance that is being mocked and controlled. This 
             enables tracking instance mocks to the actual instance
               | |
| MockedType | 
            Get the type that is mocked and controlled.
              | |
| Strict | 
            Can set the mock to be Strict
            The default is the Methods of Abstract and Interfaces are Strict and Arbitrary calls fail
            while Arbitrary Methods of concrete classes are allowed.
              | |
| StrictStatic | 
            Can set the static methods of a mocked type to be Strict
              | |
| ValidateArgsOnVerify |  Obsolete.  
            Obslolete. Argument validation is done both on calling the method and during Verify.
              | 
Methods
| Name | Description | |
|---|---|---|
| AlwaysCallOriginal | 
            Sets the expectaion of this method to always call the original method.
              | |
| AlwaysReturn(String, Object, Type) | 
            Expect unlimited calls from method, and always returns mock value
              | |
| AlwaysReturn(String, Object, Type, Type) | 
            Expect unlimited calls from method, and always returns mock value
              | |
| AlwaysThrow(String, Exception, Type) | 
            Expect unlimited calls from method, and always throws exception
              | |
| AlwaysThrow(String, Exception, Type, Type) | 
            Expect unlimited calls from method, and always throws exception
              | |
| AnonymousMethodOf | 
            Use to mock all anonymous methods that are called from within a method
              | |
| AssignField | 
            Assign a new value to the given field.
              | |
| ChangeConstructor | 
            Constructer swaping with the mocked one, keep internal
              | |
| Clear | 
            Clear all expectations 
              | |
| Clear(String) | 
            Clear expectation of a method
              | |
| Clear(ExpectationBlock) | 
            Clear expectation of an expectation block
              | |
| EndBlock | 
            End an expectation block
              | |
| Equals | Determines whether the specified Object is equal to the current Object.  (Inherited from Object.) | |
| ExpectAddEvent(String) | 
            Expect 1 event listener to be added (event += new EventHandler())
              | |
| ExpectAddEvent(String, Int32) | 
            Expect a number of event listeners to be added (event += new EventHandler())
              | |
| ExpectAddEventAlways | 
            Expect unlimited number of event listeners to be added (event += new EventHandler())
              | |
| ExpectAlways | 
            Expect unlimited calls from method
              | |
| ExpectAndReturn(String, Object, Type) | 
            Expect 1 call from method, and mock return value
              | |
| ExpectAndReturn(String, Object, Int32, Type) | 
            Expect a number of calls from method, and mock return value
              | |
| ExpectAndThrow(String, Exception, Type) | 
            Expect 1 call from method, and mock throwing an exception
              | |
| ExpectAndThrow(String, Exception, Int32, Type) | 
            Expect a number of calls from method, and mock throwing an exception
              | |
| ExpectCall(String, Type) | 
            Expect 1 call from method
              | |
| ExpectCall(String, Int32, Type) | 
            Expect a number of calls from method
              | |
| ExpectCallAndVerify |  Obsolete.  
            Verify 1 call from method , continue with method as normal
              | |
| ExpectConstructor | 
            Mock Constructor 
              | |
| ExpectConstructor(Int32) | 
            Mock Constructor
              | |
| ExpectConstructorAlways | 
            Mock unlimited calls from Constructor
              | |
| ExpectConstructorAndThrow | 
            Mock Constructor and throw exception when constructor is called
              | |
| ExpectGet(String, Object) | 
            Expect 1 get of a Property and mock the Property's value
              | |
| ExpectGet(String, Object, Int32) | 
            Expect a number of gets of a Property and mock the Property's value
              | |
| ExpectGetAlways | 
            Expect unlimited get of a Property and always mock the Property's value
              | |
| ExpectGetAndAlwaysThrow | 
            Expect unlimited get of a Property and always mock throwing an exception
              | |
| ExpectGetAndThrow(String, Exception) | 
            Expect 1 get of a Property and mock throwing an exception
              | |
| ExpectGetAndThrow(String, Exception, Int32) | 
            Expect a number of gets of a Property and mock throwing an exception
              | |
| ExpectGetIndex(Object) | 
            Expect 1 get of an Index and mock the index value
              | |
| ExpectGetIndex(Object, Int32) | 
            Expect a number of get of an Index and mock the index value
              | |
| ExpectGetIndexAlways | 
            Expect unlimited set of an Index and mock throwing an exception
              | |
| ExpectGetIndexAndAlwaysThrow | 
            Expect unlimited set of an Index and mock throwing an exception
              | |
| ExpectGetIndexAndThrow(Exception) | 
            Expect 1 get of an Index and mock throwing an exception
              | |
| ExpectGetIndexAndThrow(Exception, Int32) | 
            Expect a number of gets of an Index and mock throwing an exception
              | |
| ExpectRemoveEvent(String) | 
            Expect 1 event listener to be removed (event -= new EventHandler())
              | |
| ExpectRemoveEvent(String, Int32) | 
            Expect a number of event listeners to be removed (event -= new EventHandler())
              | |
| ExpectSet(String) | 
            Expect 1 set of a Property
              | |
| ExpectSet(String, Int32) | 
            Expect a number of sets of a Property
              | |
| ExpectSetAlways | 
            Expect unlimited set of a Property
              | |
| ExpectSetAndAlwaysThrow | 
            Expect unlimited set of a Property and always mock throwing an exception
              | |
| ExpectSetAndThrow(String, Exception) | 
            Expect 1 set of a Property and mock throwing an exception
              | |
| ExpectSetAndThrow(String, Exception, Int32) | 
            Expect  a number of sets of a Property and mock throwing an exception
              | |
| ExpectSetIndex | 
            Expect 1 set of an Index
              | |
| ExpectSetIndex(Int32) | 
            Expect a number of sets of an Index
              | |
| ExpectSetIndexAlways | 
            Expect unlimited set of an Index
              | |
| ExpectSetIndexAndAlwaysThrow | 
            Expect unlimited set of an Index and mock throwing an exception
              | |
| ExpectSetIndexAndThrow(Exception) | 
            Expect 1 set of an Index and mock throwing an exception
              | |
| ExpectSetIndexAndThrow(Exception, Int32) | 
            Expect a number of sets of an Index and mock throwing an exception
              | |
| ExpectUnmockedCall(String, Type) | 
            Verify 1 call from method , continue with method as normal
              | |
| ExpectUnmockedCall(String, Int32, Type) | 
            Verify a number of calls from method , continue with method as normal
              | |
| ExpectUnmockedConstructor | 
            Don't Mock Constructor but verify arguments 
              | |
| ExpectUnmockedConstructor(Int32) | 
            Don't Mock Constructor but verify arguments 
              | |
| ExpectUnmockedGet(String) | 
            Verify 1 get of a Property , continue with get method as normal
              | |
| ExpectUnmockedGet(String, Int32) | 
            Verify a number of gets of a Property , continue with get method as normal
              | |
| ExpectUnmockedSet(String) | 
            Verify 1 set of a Property , continue with set method as normal
              | |
| ExpectUnmockedSet(String, Int32) | 
            Verify a number of sets of a Property , continue with set method as normal
              | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.  (Inherited from Object.) | |
| GetBlock | 
            Retrieve Expectation Block, by its label name
              | |
| GetCallCount(String) | 
            Return the amount of times a method has been called
              | |
| GetCallCount(String, Type) | 
            Return the amount of times a method has been called
              | |
| GetCallIndexerCounter | 
            Return the amount of times an indexer has been called
              | |
| GetCallPropertyGetCounter | 
            Return the amount of times a property has been called
              | |
| GetCallPropertySetCounter | 
            Return the amount of times a property has been set
              | |
| GetHashCode | Serves as a hash function for a particular type.   (Inherited from Object.) | |
| GetType | Gets the Type of the current instance.  (Inherited from Object.) | |
| MemberwiseClone | Creates a shallow copy of the current Object.  (Inherited from Object.) | |
| MethodSettings | 
            Perform Behavior tweaking on methods rather then the whole mocked type
              | |
| MethodSettingsGetIndex | 
            Perform Behavior tweaking on methods rather then the whole mocked type
              | |
| MethodSettingsGetProperty | 
            Perform Behavior tweaking on methods rather then the whole mocked type
              | |
| MethodSettingsSetIndex | 
            Perform Behavior tweaking on methods rather then the whole mocked type
              | |
| MethodSettingsSetProperty | 
            Perform Behavior tweaking on methods rather then the whole mocked type
              | |
| MockConstructor |  Obsolete.  
            Mock Constructor 
              | |
| MockField |  Create a Mock object and assign it to a given field.  | |
| RemoveStaticCtor | 
            Remobing static constructer, keep internal
              | |
| StartBlock | 
            Start an expectation block
              | |
| StartBlock(String) | 
            Start an expectation block with a label name
              | |
| StartBlock(VerifyMode) | 
            Start an expectation block with a verify mode
              | |
| StartBlock(String, VerifyMode) | 
            Start an expectation block with a label and a verify mode
              | |
| StartBlockBefore(ExpectationBlock) | 
            Start an expectation block and adds the expectations before another expectation 
            block
              | |
| StartBlockBefore(ExpectationBlock, String) | 
            Start an expectation block with a label and adds the expectations before another expectation 
            block
              | |
| StartBlockBefore(ExpectationBlock, VerifyMode) | 
            Start an expectation block with a verify mode and adds the expectations before another expectation 
            block
              | |
| StartBlockBefore(ExpectationBlock, String, VerifyMode) | 
            Start an expectation block with a label and a verify mode, and adds the expectations before another expectation 
            block
              | |
| ToString | Returns a string that represents the current object.  (Inherited from Object.) | |
| Verify | 
            Verify mocked type 
              | |
| VerifyWithTimeout | 
            Wait with timeout (5 seconds) for all expected methods to be called
              | |
| VerifyWithTimeout(Int32) | 
            Wait with timeout (im milliseconds) for all expected methods to be called
              | 
Events
| Name | Description | |
|---|---|---|
| MockMethodCalled | 
            Event that is fired after a mocked method is called and after argument validation is performed
            MockMethodCalledEventHandler  | 
Remarks
- Set Up - This is the stage where you 'record' what the mocked type/object expects to do and what to return
 - Run - Run the actual class under test
 - Verify - Make sure that the mocked object acted as expected
 
These phases are managed by the Mock object.
| You cannot create a Mock directly use MockManager.Mock(Type) | 
| You cannot mock Interfaces Classes, Use MockManager.MockObject(Type, Object) | 
| When mocking a method that is declared in When mocking a method that is declared in a base class, Typemock Isolator will only mock that method when called from the mocked type. When a base method is mocked and a derived class calls that method, it WON'T be mocked | 
See Also