Exemplo n.º 1
0
        public void TestCalculateGradeProfile()
        {
            //Arrange
            StudentMarks studentMarks = new StudentMarks();

            //Act
            studentMarks.addStudent(20); studentMarks.addStudent(79); studentMarks.addStudent(70);
            studentMarks.addStudent(54); studentMarks.addStudent(33); studentMarks.addStudent(67);
            studentMarks.addStudent(99); studentMarks.addStudent(58); studentMarks.addStudent(64);
            studentMarks.addStudent(46); studentMarks.addStudent(21); studentMarks.addStudent(69);
            studentMarks.addStudent(31); studentMarks.addStudent(78); studentMarks.addStudent(89);

            studentMarks.calculateGradeProfile();

            //Assert
            int expectedPercentageFailed           = 26;
            int expectedPercentageThirdClass       = 6;
            int expectedPercentageLowerSecondClass = 13;
            int expectedPercentageUpperSecondClass = 20;
            int expectedPercentageFirstClass       = 33;

            Assert.AreEqual(expectedPercentageFailed, studentMarks.PercentageFailed);
            Assert.AreEqual(expectedPercentageThirdClass, studentMarks.PercentageThirdClass);
            Assert.AreEqual(expectedPercentageLowerSecondClass, studentMarks.PercentageLowerSecondClass);
            Assert.AreEqual(expectedPercentageUpperSecondClass, studentMarks.PercentageUpperSecondClass);
            Assert.AreEqual(expectedPercentageFirstClass, studentMarks.PercentageFirstClass);
        }
Exemplo n.º 2
0
        public void TestCalculateStats()
        {
            //Arrange
            StudentMarks studentMarks = new StudentMarks();

            //Act
            studentMarks.addStudent(20); studentMarks.addStudent(79); studentMarks.addStudent(70);
            studentMarks.addStudent(54); studentMarks.addStudent(33); studentMarks.addStudent(67);
            studentMarks.addStudent(99); studentMarks.addStudent(58); studentMarks.addStudent(64);
            studentMarks.addStudent(46); studentMarks.addStudent(21); studentMarks.addStudent(69);
            studentMarks.addStudent(31); studentMarks.addStudent(78); studentMarks.addStudent(89);

            studentMarks.calculateStats();

            //Assert
            int expectedMean = 58;
            int expectedMin  = 20;
            int expectedMax  = 99;

            Assert.AreEqual(expectedMean, studentMarks.MeanMark);
            Assert.AreEqual(expectedMin, studentMarks.MinMark);
            Assert.AreEqual(expectedMax, studentMarks.MaxMark);
        }