예제 #1
0
        public void BookCalculatesAnAverageGrade()
        {
            var book = new InMemoryBook("");

            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            var result = book.GetStatics();

            Assert.Equal(85.6, result.Average, 1);
            Assert.Equal(90.5, result.High, 1);
            Assert.Equal(77.3, result.Low, 1);
            Assert.Equal('B', result.Letter);
        }
예제 #2
0
        public void BookCalculateAnAverageGrade()
        {
            // aarange
            var book = new InMemoryBook("Aaru");

            book.AddGrade(22.2);
            book.AddGrade(33.3);
            book.AddGrade(11.1);
            book.AddGrade(44.4);

            // act
            var result = book.GetStatics();

            // assert
            Assert.Equal(27.75, result.Average);
            Assert.Equal(11.1, result.LowGrade);
            Assert.Equal(44.4, result.HighGrade);
        }