I want to reuse a test method with other test cases, as they share the same functionality, but using different parameters. In the code below, annualSalary
, periodPortion
will be will be different. My question, is there a way to reuse the entire code block below for other test cases to avoid repeated code in other test methods?
int actualTaxResult = IncomeTax.GetIncomeTax(annualSalary, _periodPortion);
//int expectedTaxAmount = 922;
if (actualTaxResult != expectedTaxAmount)
{
Assert.Fail(String.Format("Expected tax amount: {0}, but actual result is {1}", expectedTaxAmount, actualTaxResult));
}
Aucun commentaire:
Enregistrer un commentaire