public void ThrowsWhenInvalid() { FontVariant fv = new FontVariant(); List<int> invalidValuesToTry = new List<int> { -500,-5555,0,10,125,501,999 }; foreach (int valueToTry in invalidValuesToTry) { bool exceptionRaised = false; try { fv.Weight = valueToTry; } catch (InvalidValueException) { exceptionRaised = true; } if (!exceptionRaised) { Assert.Fail(string.Format("The invalid weight value provided [{0}] did not raise an exception as expected",valueToTry)); } } }
public void SetsCorrectlyWhenSingleDigit() { FontVariant fv = new FontVariant(); List<int> valuesToTry = new List<int> { 1,2,3,4,5,6,7 }; foreach (int i in valuesToTry) { fv.Weight = i; Assert.AreEqual(i, fv.Weight); } }
public void SetsCorretlyWhenThreeDigits() { FontVariant fv = new FontVariant(); List<int> valuesToTry = new List<int> { 100,200,300,400,500,600,700 }; foreach (int valueToTry in valuesToTry) { fv.Weight = valueToTry; Assert.AreEqual(valueToTry/100, fv.Weight); } }