This project contains basics of mocking in .Net. We show how to create manual mocks and how to use Moq library. Code was used as examples for a post on our blog.
In project we show:
- How to use manual mocks
- How to write simple test with basic Moq usage
- How to setup method with Moq to throw an exception
- How to check with Moq if mocked method was called and how many times
- How to setup method with Moq to return different values on each call
- How to setup a method with Moq to raise an event or how to raise an event by hand
You will need Visual Studio 2017 with installed NUnit Runner extension.
In this project we used:
- C#
- NUnit
- Moq