NSubstitute logo
C1249F0E-8D06-4407-9877-A93914C30612
/ nuget package

NSubstitute

NSubstitute is a friendly substitute for .NET mocking libraries
82
7
+ 1
0

What is NSubstitute?

NSubstitute is a friendly substitute for .NET mocking libraries. It has a simple, succinct syntax to help developers write clearer tests. NSubstitute is designed for Arrange-Act-Assert (AAA) testing and with Test Driven Development (TDD) in mind.
NSubstitute is a tool in the NuGet Packages category of a tech stack.

Keywords

testing
tdd
mocking
mocks
unit-testing
AAA

Who uses NSubstitute?

Companies
3 companies reportedly use NSubstitute in their tech stacks, including Thrift, Abp, and Windows Desktop Applications.

Developers
19 developers on StackShare have stated that they use NSubstitute.

Built For

Decisions about NSubstitute

Here are some stack decisions, common use cases and reviews by companies and developers who chose NSubstitute in their tech stack.

I used in some project the NSubstitute intead of Moq because NSubstitute it's better clean code, example:

Moq like this:

// Arrange
ICalculator lovable = Mock.Of<ICalculator>(calculator => calculator.Add(1, 2) == 3);

// Act
var result = calculator.Add(1, 2);

// Assert
Assert.AreEqual(3, result);

NSubstitute like this:

// Arrange
var calculator = Substitute.For<ICalculator>().Add(1, 2).Returns(3);

// Act
var result = calculator.Add(1, 2);

// Assert
Assert.AreEqual(3, result);
See more

NSubstitute Comparisons

Related Comparisons
No related comparisons found

NSubstitute's Followers
7 developers follow NSubstitute to keep up with related blogs and decisions.