I plan on using Moq to mock some interfaces in the unit test code I've created. I've already downloaded the latest version of Moq.
My question is how do I install it? Where should I place the Moq.dll?
I've tried searching on the internet, but all I can find are samples of how to use Moq, not how to install it.
Moq is a mocking framework for C#/. NET. It is used in unit testing to isolate your class under test from its dependencies and ensure that the proper methods on the dependent objects are being called. For more information on mocking you may want to look at the Wikipedia article on Mock Objects.
4.11. 0 (2019-05-28)
Moq is a library that allows us to create mock objects in test code. It is also available in NuGet. This library also supports . NET Core.
The best way to add reference to Moq framework is installing it from Nuget. Also you still can download Moq.dll and add reference to this library (usually I create folder libs
under the solution folder, where I put all third-party libraries, which is not available via Nuget).
BTW Another option to install package from Nuget - right click on project references and select Manage Nuget packages...
. Then search online for Moq and install it. See why use Nuget over installing libraries directly on my machine
There's no need to install it. Just add a reference to the moq.dll in your project.
But of course you can use gacutil
to register the library in your global assembly cache.
c:\path> gacutil /i Moq.dll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With