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
Property Value
Type: BooleanRemarks
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(); }
![]() |
---|
To set only one method to strict use: MethodSettings(String) |
![]() |
---|
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