Ejemplo n.º 1
0
            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));
                    }
                }
            }
Ejemplo n.º 2
0
            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);
                }
            }
Ejemplo n.º 3
0
            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);
                }
            }