When unit testing, you are often interested in testing a portion of a complete system isolated from dependencies. To test a portion of the system, we can use mock objects to replace the dependencies. A mock object implements at least part of the same interface
When unit testing, you are often interested in testing a portion of a complete system isolated from dependencies. To test a portion of the system, we can use mock objects to replace the dependencies. A mock object implements at least part of the same interface as the production object, but often in a simpler, faster, more predictable, or more controllable way.
To get started, see Create Mock Object.
|Define return values for method called or property accessed|
|Take no action|
|Invoke function handle when method is called|
|Return stored property value|
|Store property value|
|Throw exception when method is called or when property is set or accessed|
|Constraint qualifying mock object interactions|
|Constraint determining property get access|
|Constraint determining method call|
|Constraint determining property set interaction|
|Specify mock object method behavior and qualify method calls|
|Specify mock object property behavior and qualify interactions|
|Specify mock property get behavior|
|Specify mock object set behavior|
Test a portion of a complete system in isolation using a mock.
Define behavior for mocked methods and properties. For example, you can specify that a method returns predefined values.
Intercept mes