Showing all posts tagged: 'mocking'

A 1-post collection

Improve your unit tests with Moq and Mock.Of<>()

Spending my days writing lots of unit tests lately...You know the drill. For most of my tests, I like to use Moq, the .NET mocking library that allows you to mock objects and services. It's one of the best libraries for complementing and supporting unit tests. So today, I came across the Mock.Of<T>(). When creating a mock, we tend to use the following syntax: var mockService = new Mock<ISomeService>(); And then we setup the mock with the appropriate property values and methods in order to use it in our unit tests. So, in …[read more]