[Theory]

An xUnit a unit test with input parameters.

Define [Theory]

In xUnit [Theory] creates a unit test with input parameters. The inputs are defined using [InlineData].

[Theory]
[InlineData(100, 108)]
[InlineData(0, 0)]
public void WithTax_AddsEightPercent(decimal price, decimal expected) =>
    Assert.Equal(expected, PriceCalculator.WithTax(price));

Level: Journeyman · More C# terms at this level

Updated