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()); } }); }