Moq Mock Object. Moq is a famous library for tests and i don t need to overstate it. In the code above line 4 creates an employee object with all its properties having their default values unless their values are set in a.
When creating a mock we tend to use the following syntax. Accessing the underlying proxied object when passing the mock to our code for these times moq has a static of method which takes a generic parameter that gives us something we can use directly in our tests. Moq is a famous library for tests and i don t need to overstate it.
A mock object is an object that can act as a real object but can be controlled in test code.
However i need to create mock object for my setup. You should use moq to create your mock object and set callbase property to true to use the object behavior. This is called partial mock. In the code above line 4 creates an employee object with all its properties having their default values unless their values are set in a.