All quizzes
Free quiz · 20 questions in the bank

xUnit quiz

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

Question 1/12Score 0

How do you run xUnit tests from the command line for a .NET project?

In this round
  1. How do you run xUnit tests from the command line for a .NET project?
  2. What is a reasonable use case for `ITestOutputHelper` in xUnit?
  3. What does `[InlineData]` provide when used with a `[Theory]` test method?
  4. What is `[Theory]` used for in xUnit, and how does it differ from `[Fact]`?
  5. What is a "Category"/"Trait" mechanism used for in xUnit (via the `[Trait]` attribute)?
  6. Why does xUnit's constructor-based, new-instance-per-test approach to setup arguably provide stronger test isolation guarantees than a shared-instance-with-[SetUp]-method approach used by some other frameworks?
  7. What is `Assert.Collection()` used for in xUnit, and what advantage does it offer over manually checking a collection's count and then indexing into specific elements?
  8. What is the relationship between xUnit and a mocking library like Moq, given that xUnit itself doesn't provide mocking functionality?
  9. What is `Assert.NotNull()` (and its counterpart `Assert.Null()`) used for in xUnit?
  10. What is `[MemberData]` used for as an alternative to `[InlineData]` in an xUnit `[Theory]` test?
  11. How does the choice between `[Fact]` and `[Theory]` typically relate to test readability and maintenance, when a team has several closely related test scenarios differing only in specific input values?
  12. What does `Assert.Equal()` do in xUnit?
Gaps to close?
Read the curated xUnit notes — core concepts, patterns, interview prep.
xUnit notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web