I am looking to use MS testing framework to test a tax calculator and needs to run over 100 test cases. As see below, I have set up an array of testCases and loop through each but the when I run Tests, it only returns one return.
Question:
- Is there a way for every test display result?
- How do I return each test results? Currently, the system only returns values if failed.
[DataTestMethod]
public void CalculateResult(int val)
{
// arrange
int[] testCase = { 1000,2000, 35000, 400003, 59509 };
foreach (int income in testCase)
{
double expectOutput = TaxCalculator(income);
// act
SUT.GeneralTaxRule generalTaxationRule = new SUT.GeneralTaxRule(income);
double actualOutput = generalTaxationRule.getTax();
// assert
Assert.AreEqual(expectOutput, actualOutput);
Console.WriteLine(expectOutput, actualOutput);
}
}