ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect…

Follow publication

Member-only story

How to migrate from Moq to NSubstitute

Alexander Wichmann Carlsen
ITNEXT
Published in
2 min readAug 10, 2023

Table of contents

Basic Migration Steps:

Step 1: Install NSubstitute Package

Install-Package NSubstitute

Step 2: Replace Moq Imports

using NSubstitute;
// using Moq; (Remove this line)

Step 3: Creating Mocks

var mockService = new Mock<IService>();
mockService.Setup(s => s.Method()).Returns(result)…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect, collaborate, learn and experience next-gen technologies.

Responses (1)

Write a response