Exemple #1
0
        public void TestThreeGradesDoubleExecute()
        {
            SchoolSubject math = new SchoolSubject
            {
                Name = "Mathe",
            };

            math.Grades    = new double[3];
            math.Grades[0] = 3;
            math.Grades[1] = 2;
            math.Grades[2] = 4;
            var result = math.CalculateAverage();

            result = math.CalculateAverage();
            Assert.AreEqual(3, result);
        }
Exemple #2
0
        public void TestNoGrades()
        {
            SchoolSubject math = new SchoolSubject
            {
                Name = "Mathe",
            };

            var result = math.CalculateAverage();

            Assert.AreEqual(0, result);
        }
Exemple #3
0
        public void TestEmptyGrades()
        {
            SchoolSubject math = new SchoolSubject
            {
                Name = "Mathe",
            };

            math.Grades = new double[4];
            var result = math.CalculateAverage();

            Assert.AreEqual(0, result);
        }
Exemple #4
0
        public void TestFourGrades()
        {
            SchoolSubject math = new SchoolSubject
            {
                Name = "Mathe",
            };

            math.Grades    = new double[4];
            math.Grades[0] = 3;
            math.Grades[1] = 2;
            math.Grades[2] = 4;
            math.Grades[3] = 3;
            var result = math.CalculateAverage();

            Assert.AreEqual(3, result);
        }