Consider the following test:
[TestCase(2016, true)]
[TestCase(2017, false)]
[TestCase(2018, false)]
[TestCase(2019, false)]
[TestCase(2020, true)]
public void When_IsLeapYear_ReturnTrueForLeapYear(int year, bool expectedResult)
{
//Act
var result = _sut.IsLeapYear(year);
//Assert
Assert.AreEqual(result, expectedResult);
}
Is it a bad practice to include both the year and the expected results in testcases like that, instead of creating two different tests (e.g. one for expecting true, one for expecting false?)
Thanks
Aucun commentaire:
Enregistrer un commentaire