Member-only story
How to migrate from Moq to NSubstitute
Seamless Migration from Moq to NSubstitute

All of my stories are free. If you aren’t a member, you can read it here.
Table of contents
Basic Migration Steps:
Step 1: Install NSubstitute Package
Begin by installing the NSubstitute NuGet package into your project. You can do this via the NuGet Package Manager Console or the Visual Studio NuGet Package Manager.
Install-Package NSubstitute
Step 2: Replace Moq Imports
Update your test classes to use the NSubstitute namespace instead of Moq:
using NSubstitute;
// using Moq; (Remove this line)
Step 3: Creating Mocks
NSubstitute provides a Substitute
class to create substitutes (mocks) for your classes and interfaces. Replace your Moq mock setup with NSubstitute syntax:
Moq:
var mockService = new Mock<IService>();
mockService.Setup(s => s.Method()).Returns(result)…