[Test] // do boundary value analysis for all the grade ranges // using a grade range supplied by user public void CalculateGrade_UseUserDefinedValues_NoException() { int[] gradeRanges = { 49, 69, 89, 100 }; string[] gradeSymbols = { "F", "C", "B", "A" }; double[] gradePointValues = { 0, 1.0, 2.0, 3.0 }; GradingScheme myscheme = new GradingScheme(gradeRanges, gradeSymbols, gradePointValues); UnitGrade ugrade; ugrade = new UnitGrade("unit", "12345", 49); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("F", ugrade.gradeSymbol); Assert.AreEqual(0.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 50); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("C", ugrade.gradeSymbol); Assert.AreEqual(1.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 69); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("C", ugrade.gradeSymbol); Assert.AreEqual(1.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 70); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("B", ugrade.gradeSymbol); Assert.AreEqual(2.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 89); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("B", ugrade.gradeSymbol); Assert.AreEqual(2.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 90); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("A", ugrade.gradeSymbol); Assert.AreEqual(3.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 100); ugrade.gradingScheme = myscheme; ugrade.CalculateGrade(); Assert.AreEqual("A", ugrade.gradeSymbol); Assert.AreEqual(3.0, ugrade.gradePoint); }
[Test] // do boundary value analysis for all the grade ranges public void CalculateGrade_UseDefaultValues_NoException() { UnitGrade ugrade; ugrade = new UnitGrade("unit", "12345", 49); ugrade.CalculateGrade(); Assert.AreEqual("F", ugrade.gradeSymbol); Assert.AreEqual(0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 50); ugrade.CalculateGrade(); Assert.AreEqual("C", ugrade.gradeSymbol); Assert.AreEqual(2.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 54); ugrade.CalculateGrade(); Assert.AreEqual("C", ugrade.gradeSymbol); Assert.AreEqual(2.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 55); ugrade.CalculateGrade(); Assert.AreEqual("C+", ugrade.gradeSymbol); Assert.AreEqual(2.33, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 59); ugrade.CalculateGrade(); Assert.AreEqual("C+", ugrade.gradeSymbol); Assert.AreEqual(2.33, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 60); ugrade.CalculateGrade(); Assert.AreEqual("B-", ugrade.gradeSymbol); Assert.AreEqual(2.67, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 64); ugrade.CalculateGrade(); Assert.AreEqual("B-", ugrade.gradeSymbol); Assert.AreEqual(2.67, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 65); ugrade.CalculateGrade(); Assert.AreEqual("B", ugrade.gradeSymbol); Assert.AreEqual(3.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 69); ugrade.CalculateGrade(); Assert.AreEqual("B", ugrade.gradeSymbol); Assert.AreEqual(3.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 70); ugrade.CalculateGrade(); Assert.AreEqual("B+", ugrade.gradeSymbol); Assert.AreEqual(3.33, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 74); ugrade.CalculateGrade(); Assert.AreEqual("B+", ugrade.gradeSymbol); Assert.AreEqual(3.33, ugrade.gradePoint); ugrade = new UnitGrade("unit3", "12345", 79); ugrade.CalculateGrade(); Assert.AreEqual("A-", ugrade.gradeSymbol); Assert.AreEqual(3.67, ugrade.gradePoint); ugrade = new UnitGrade("unit3", "12345", 80); ugrade.CalculateGrade(); Assert.AreEqual("A", ugrade.gradeSymbol); Assert.AreEqual(4.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 89); ugrade.CalculateGrade(); Assert.AreEqual("A", ugrade.gradeSymbol); Assert.AreEqual(4.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 90); ugrade.CalculateGrade(); Assert.AreEqual("A+", ugrade.gradeSymbol); Assert.AreEqual(4.0, ugrade.gradePoint); ugrade = new UnitGrade("unit", "12345", 100); ugrade.CalculateGrade(); Assert.AreEqual("A+", ugrade.gradeSymbol); Assert.AreEqual(4.0, ugrade.gradePoint); }