示例#1
0
        public void ComputeLowestGrade()
        {
            GradeBook.GradeBook book = new GradeBook.GradeBook();
            book.AddGrade(10);
            book.AddGrade(90);

            GradeBook.GradeStatistics result = book.ComputeStatistics();
            //Assert.AreEqual(90, result.LowestGrade);//fail
            Assert.AreEqual(10, result.LowestGrade);//pass
        }
示例#2
0
        public void ComputeAverageGrade()
        {
            GradeBook.GradeBook book = new GradeBook.GradeBook();
            book.AddGrade(91);
            book.AddGrade(89.5f);//explicitly convert double 89.5 to float by adding f
            book.AddGrade(75);

            GradeBook.GradeStatistics result = book.ComputeStatistics();
            //Assert.AreEqual(85.16, result.AverageGrade);//fail
            Assert.AreEqual(85.16, result.AverageGrade, 0.01);
            ////failed. Expected:<85.16>. Actual:<85.1666641235352>
        }