public void TestComputeAverage() { Module m = new Module(); AvgScore avgExpected = new AvgScore(15, m); Notebook nb = new Notebook(); Assert.Null(m.ComputeAverage(nb.ListExams())); Exam e1 = new Exam { Score = 10, Coef = 1, Module = m }; nb.AddExam(e1); Exam e2 = new Exam { Score = 10, Coef = 2, Module = m }; nb.AddExam(e2); Exam e3 = new Exam { Score = 20, Coef = 3, Module = m }; nb.AddExam(e3); Assert.Equal(avgExpected.Average, m.ComputeAverage(nb.ListExams()).Average); }
public void TestAddExam() { Notebook notebook = new Notebook(); Module m = new Module(); Exam exam = new Exam() { Coef = 15, Module = m }; notebook.AddExam(exam); Assert.Equal(exam, notebook.ListExams().GetValue(0)); Assert.Equal(1, notebook.ListExams().Length); }