All quizzes
Free quiz · 20 questions in the bank

NSubstitute quiz

Test your NSubstitute knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is the basic syntax for creating a substitute of an interface with NSubstitute?

Questions in this quiz
  1. What is the basic syntax for creating a substitute of an interface with NSubstitute?
  2. How does NSubstitute handle mocking async methods (returning `Task<T>`)?
  3. How do you configure a substitute's method to return a specific value in NSubstitute?
  4. What is the purpose of NSubstitute's support for configuring a sequence of DIFFERENT return values across multiple calls to the same method?
  5. What does the term "substitute" specifically emphasize about NSubstitute's naming/design philosophy, compared to the more common industry term "mock"?
  6. What is NSubstitute?
  7. How would you configure an NSubstitute substitute to throw an exception when a method is called, to test error-handling logic?
  8. What is the significance of NSubstitute (like other .NET mocking libraries) being commonly paired with dependency injection as a design pattern in the code under test?
  9. What is a reasonable comparison between NSubstitute's syntax philosophy and Moq's, given that both are popular .NET mocking libraries solving the same underlying problem?
  10. How does NSubstitute support configuring a substitute's property (rather than a method) to return a specific value?
  11. How do you verify that a specific method was called on an NSubstitute substitute?
  12. What is `Arg.Is<T>()` used for as a more specific alternative to `Arg.Any<T>()` in NSubstitute?
Gaps to close?
Read the curated NSubstitute notes — core concepts, patterns, interview prep.
NSubstitute notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web