nsubstitute/NSubstitute
A friendly substitute for .NET mocking libraries. observed · 2026-08-28
Health v2 · maintenance only
98/100
- Activity 99
- Release rhythm 97
- Longevity 100
Flags: no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 27
- age_days: 6158
- days_rel: 22
- days_push: 9
- n_releases_24m: 4
Adoption not part of the score
2972 stars · 282 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
NSubstitute is a mocking library for .NET that generates substitute instances for interfaces and virtual members with a succinct, natural syntax. It focuses on Arrange-Act-Assert testing, letting developers set return values, check received calls, and raise events with minimal configuration noise.
Use cases
- mock dependencies in .NET unit tests
- create stubs for interfaces in C# tests
- verify a method was called with specific arguments
- set return values for test doubles
- raise events on mocked objects in tests
- learn test-driven development with an easy mocking library
When to choose
- you want a simple, readable mocking API with less boilerplate than Moq or Rhino Mocks
- your tests follow the Arrange-Act-Assert pattern
- you are new to unit testing and want a low-friction mocking library
- you only need to mock interfaces or virtual members
When to avoid
- you need to mock non-virtual members or static methods
- you require advanced features like partial mocking of complex class internals
- your project is not on the .NET platform
Facets
library · maturity stable
testing mocking testing developer-tools dotnet test-doubles stubs fakes arrange-act-assert c-sharp nuget
2 sources
- readme: https://github.com/nsubstitute/NSubstitute · fetched 2026-08-28 · d9edae7643c3
- homepage: https://nsubstitute.github.io · fetched 2026-08-29 · 7f9c77b95f1b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| nsubstitute/NSubstitute | main | 98 |
For agents
markdown · JSON · MCP: product_card(name="nsubstitute/NSubstitute")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem