HomeChallengesRepsProblemsLeaderboardTake a challenge

Five tests, one behaviour

Copy-pasted [Fact]s with one number changed. Collapse them into a [Theory].

Beginner12 min on the clock5 graded checks · 100 pointsTesting an ASP.NET Core API
Graded by reading your code against the checklist below.

What you build

  • Replace the five [Fact] methods with one [Theory]
  • Give it an [InlineData] row per case, including the expected result
  • Take the age and the expected value as method parameters
  • Keep every boundary the original covered — 17, 18, 65 and 66
  • Leave no [Fact] copies behind

Done means

One [Theory] with at least five [InlineData] rows covering both boundaries, and no [Fact] left.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. One [Theory] replaces the copies+20One test, many cases
  2. Each case is an [InlineData] row+20One test, many cases
  3. The method takes the row values as parameters+20One test, many cases
  4. Every boundary the copies covered survives+25Off by one
  5. The copy-pasted [Fact] methods are gone+15One test, many cases

What it teaches

The rest of Testing an ASP.NET Core API