private ExamResult GivenMathExamResult() { var result = new ExamResult("Math"); result.Add(new Grade("Li Lei", 80)); result.Add(new Grade("Han Meimei", 90)); return result; }
private ExamResult GivenChineseExamResult() { var result = new ExamResult("Chinese"); result.Add(new Grade("Li Lei", 80)); result.Add(new Grade("Han Meimei", 90)); return result; }
public void should_convert_english_exam_result_to_a_list_of_transcripts() { var result = new ExamResult("English"); result.Add(new Grade("Li Lei", 80)); result.Add(new Grade("Han Meimei", 90)); var transcripts = result.ToTranscripts(); Assert.AreEqual(80, transcripts[0].English); Assert.AreEqual("Li Lei", transcripts[0].Name); Assert.AreEqual(90, transcripts[1].English); Assert.AreEqual("Han Meimei", transcripts[1].Name); }
public void Register(ExamResult result) { result.ToTranscripts(). ForEach(newTranscript => { var found = Transcripts.Find(transcript => transcript.Name == newTranscript.Name); if(found != null) { found.Merge(newTranscript); } else { Transcripts.Add(newTranscript.Clone()); } }); }
public void should_get_grade_after_added() { var kiteGrade = new Grade("Kite", 80); var results = new ExamResult("Math"); results.Add(kiteGrade); Assert.AreEqual(1, results.Results.Count); Assert.AreEqual("Kite", results.Results[0].Name); Assert.AreEqual(80, results.Results[0].Score); }
public void should_not_add_duplicate_grade_which_has_same_name_with_another() { var kiteGrade = new Grade("Kite", 80); var dupKiteGrade = new Grade("Kite", 90); var results = new ExamResult("Math"); results.Add(kiteGrade); results.Add(dupKiteGrade); Assert.AreEqual(1, results.Results.Count); Assert.AreEqual("Kite", results.Results[0].Name); Assert.AreEqual(80, results.Results[0].Score); }