Ejemplo n.º 1
0
        public void ComputesLowestGrade()
        {
            GradeBook book = new GradeBook();

            book.AddGrades(10);
            book.AddGrades(90);

            GradeStatistics result = book.ComputeStatistics();

            Assert.AreEqual(10, result.LowestGrade);
        }
Ejemplo n.º 2
0
        public void IsDescriptionGradeNameCorrect()
        {
            GradeBook book = new GradeBook();

            book.AddGrades(91);
            book.AddGrades(89.5f);
            book.AddGrades(75);

            GradeStatistics result = book.ComputeStatistics();

            Assert.AreEqual("Good", result.Description);
        }
Ejemplo n.º 3
0
        public void ComputesAvarageGrade()
        {
            GradeBook book = new GradeBook();

            book.AddGrades(91);
            book.AddGrades(89.5f);
            book.AddGrades(75);

            GradeStatistics result = book.ComputeStatistics();

            Assert.AreEqual(85.16, result.AvareGrade, 0.01);
        }
Ejemplo n.º 4
0
        public void ComputesLetterGrade()
        {
            GradeBook book = new GradeBook();

            book.AddGrades(91);
            book.AddGrades(89.5f);
            book.AddGrades(75);
            book.WriteGrades(Console.Out);

            GradeStatistics result = book.ComputeStatistics();

            Assert.AreEqual("B", result.LetterGrade);
        }
Ejemplo n.º 5
0
        public void TestWriteGradesWithStreamWriter()
        {
            using (StreamWriter outputFile = File.CreateText("grades.txt"))
            {
                GradeBook book = new GradeBook();
                book.AddGrades(91);
                book.WriteGrades(outputFile);

                Assert.IsNotNull(outputFile);
            }
        }
Ejemplo n.º 6
0
        public void TestWriteGrades()
        {
            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);

                GradeBook book = new GradeBook();
                book.AddGrades(91);
                book.WriteGrades(Console.Out);

                string expected = string.Format("91{0}", Environment.NewLine);
                Assert.AreEqual <string>(expected, sw.ToString());
            }
        }