This project provide a sample that shows how to use moq package in C#.
I also wrote an article in the following address that completely explains Unit testing with Moq in C#:
https://www.linkedin.com/pulse/unit-testing-moq-c-amir-doosti-oulef
The solution contains one Console App project and one xUnit test project which are written in Visual Studio.
You will find descriptive comments on top of each test.
- OS: Windows 10 Enterprise - 64 bits
- IDE: Visual Studio Enterprise 2022 (64 bits) - version 17.2.5
- Framework: .Net 6
- Language: C#
- Test Framework: xUnit
- Packages: Moq
Open the solution in Visual Studio and run it using F5. You will see the output in a console.
Also open "Test Explorer" and run all tests there.