xUnit.net theory attribute for creating data-driven tests

In xUnit.net, data-driven tests are known as theories. They are tests decorated with the Theory attribute. When a test method is decorated with the Theory attribute, it must additionally be decorated with a data attribute, which will be used by the test runner to determine the source of the data to be used in executing the test:

[Theory]public void Test_CalculateRates_ShouldReturnRate(){   // test not implemented yet}

When a test is marked as data theory, the data fed into it from the data source is directly mapped to the parameters of the test method. Unlike the regular test decorated with the Fact attribute, which is executed only once, the number of times a data theory is executed ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.