Test your Moq knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
What is the purpose of `.Callback()` in a Moq setup?
Questions in this quiz
What is the purpose of `.Callback()` in a Moq setup?
What is a common reason a team chooses to mock a dependency in a unit test rather than using the real implementation?
Why must a class member be declared as `virtual` (for a class, as opposed to an interface) in order for Moq to mock it?
What does chaining multiple `.Setup()` calls for the SAME method but with DIFFERENT specific argument values achieve on a Moq mock?
What is `MockBehavior.Strict` versus the default `MockBehavior.Loose` in Moq?
What is the purpose of `mockRepo.Object` after configuring a Moq mock?
What is Moq?
What does mocking a dependency's interface (rather than testing against the real concrete implementation) allow a unit test to achieve?
What is a reasonable comparison between Moq and NSubstitute, another popular .NET mocking library?
What does `.Verify()` let you check on a Moq mock, and why is this useful?
What does `mockRepo.Setup(r => r.GetAllUsers()).Returns(new List<User> { user1, user2 });` demonstrate about controlling collection-returning methods with Moq?
What is the purpose of setting up a mocked property (rather than a method) with Moq, e.g. `mockConfig.Setup(c => c.IsEnabled).Returns(true);`?