Creates a new mock object.
Assigns an expectation to a mock object. This is used to create methods and properties on the mock object that are monitored for calls and changes, respectively.
The object to add the expectation to.
An object defining the expectation. For properties, the keys "property" and "value" are required. For a method the "method" key defines the method's name, the optional "args" key provides an array of argument types. The "returns" key provides an optional return value. An optional "run" key provides a function to be used as the method body. The return value of a mocked method is determined first by the "returns" key, then the "run" function's return value. If neither "returns" nor "run" is provided undefined is returned. An optional 'error' key defines an error type to be thrown in all cases. The "callCount" key provides an optional number of times the method is expected to be called (the default is 1).