nunit Attributes ValuesAttribute


Example

The ValuesAttribute is used to specify a set of values for an individual parameter of a test method with parameters.

    [Test]
    public void Sum_Works_Correctly(
        [Values(1, 2, 3)] int x,
        [Values(4, 5)] int y)
    {
        // Arrange
        var calculator = new Calculator();

        // Act
        int result = calculator.Sum(x, y);

        // Assert
        Assert.That(result, Is.EqualTo(x + y));
    }

Here we can see which test cases are run against these values:

enter image description here