NSubstitute is designed for Arrange-Act-Assert (AAA) testing, so you just need to arrange how it should work, then assert it received the calls you expected once you're done. Because you've got more important code to write than whether you need a mock or a stub. It is an attempt to satisfy our craving for a mocking library with a succinct syntax that helps us keep the focus on the intention of our tests, rather than on the configuration of our test doubles. We've tried to make the most frequently required operations obvious and easy to use, keeping less usual scenarios discoverable and accessible, and all the while maintaining as much natural language as possible. There are already some great mocking libraries around for .NET, so why create another? We found that for all their great features, none of the existing libraries had the succinct syntax we were craving — the code required to configure test doubles quickly obscured the intention behind our tests.

Features

  • Perfect for those new to testing, and for others who would just like to to get their tests written with less noise and fewer lambdas
  • Simple, succinct, pleasant to use
  • Helpful exceptions
  • Don't sweat the small stuff
  • Just substitute for the type you need
  • NSubstitute is designed for Arrange-Act-Assert (AAA) testing

Project Samples

Project Activity

See All Activity >

Categories

Frameworks, Libraries

License

MIT License

Follow NSubstitute

NSubstitute Web Site

Other Useful Business Software
Forever Free Full-Stack Observability | Grafana Cloud Icon
Forever Free Full-Stack Observability | Grafana Cloud

Our generous forever free tier includes the full platform, including the AI Assistant, for 3 users with 10k metrics, 50GB logs, and 50GB traces.

Built on open standards like Prometheus and OpenTelemetry, Grafana Cloud includes Kubernetes Monitoring, Application Observability, Incident Response, plus the AI-powered Grafana Assistant. Get started with our generous free tier today.
Create free account
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of NSubstitute!

Additional Project Details

Programming Language

C#

Related Categories

C# Frameworks, C# Libraries

Registered

2022-09-15