Exemple #1
0
        public void GetAvgMarks_Empty_Nan()
        {
            Student s1 = new Student();
            Student s2 = new Student {
                Marks = new Mark[] { }
            };

            Assert.IsTrue(float.IsNaN(s1.GetAvgMark()) && float.IsNaN(s2.GetAvgMark()));
        }
        public void GetAvgMarks_Avg()
        {
            Mark[] marks = new Mark[]
            {
                new Mark {
                    SubjectName = "1", Value = 9
                },
                new Mark {
                    SubjectName = "2", Value = 10
                },
                new Mark {
                    SubjectName = "3", Value = 9
                }
            };
            Student student = new Student("Unset", "Unset", "Unset", marks: marks);
            string  actual  = Math.Round(student.GetAvgMark(), 2).ToString().Replace(',', '.');

            Assert.AreEqual("9.33", actual);
        }
Exemple #3
0
        public void GetAvgMarks_Avg()
        {
            Student student = new Student
            {
                Marks = new Mark[]
                {
                    new Mark {
                        Value = 9
                    },
                    new Mark {
                        Value = 9
                    },
                    new Mark {
                        Value = 10
                    }
                }
            };
            string actual = Math.Round(student.GetAvgMark(), 2).ToString().Replace(',', '.');

            Assert.AreEqual("9.33", actual);
        }
        public void GetAvgMarks_Empty_Nan()
        {
            Student student = new Student("Unset", "Unset", "Unset");

            Assert.IsTrue(float.IsNaN(student.GetAvgMark()));
        }