MockStrict Property

Typemock Isolator Developer Guide
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.

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

public bool Strict { get; set; }

Property Value

Type: Boolean
Remarks

By default Mocked Concrete Types are NOT strict this mean that if a call to a mocked method was not expected the normal code is executed. Mocked Types can be made strict and fail if an unexpected call is made
Examples

[Test]
public void Test()
{
    // Start mocking TestedClass
    Mock mock = MockManager.Mock(typeof(TestedClass));
    TestedClass t = new TestedClass();
    // No expectations, the following will run normal passInt if Strict=false
    // and will fail if Strict=true 
    t.passInt(10);
    MockManager.Verify();
}
Note Note
To set only one method to strict use: MethodSettings(String)
Note Note
When allowing arbitrary abstract methods (methods created dynamically by Typemock Isolator using MockObject(Type, Object) or CreateMockedObject(Type)), Typemock Isolator create the following default behavior: 1. All void calls just return 2. Other Methods will return 0 or null depending on the return type 3. Properties will behave like normal properties
See Also

Reference