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 is based on the available data rows fetched from the data source.
At least one data attribute is required to be passed as the test method argument for xUnit.net to treat the test as data-driven and execute it successfully. The data attribute to be passed...