Beispiel #1
0
        public void TestWriteGradesWithStreamWriter()
        {
            using (StreamWriter outputFile = File.CreateText("grades.txt"))
            {
                GradeBook book = new GradeBook();
                book.AddGrades(91);
                book.WriteGrades(outputFile);

                Assert.IsNotNull(outputFile);
            }
        }
Beispiel #2
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);
        }
Beispiel #3
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());
            }
        }