public void GetandAddFileListTest() { MeetingNode meeting0 = new MeetingNode(mTitle, mID, sTime, eTime, PID, Attendents); MeetingNode meeting = new MeetingNode(mTitle, mID, sTime, eTime, PID, Attendents); //test get 0 GetFileList meeting0.AddFiles(0); LinkedList <Int32> actualFileList0 = meeting0.GetFileList(); LinkedList <Int32> expectedFileList0 = new LinkedList <Int32>(); expectedFileList0.AddLast(0); Assert.AreEqual(expectedFileList0.Last.Value, actualFileList0.Last.Value, "Actual FileList does not contain 0, Expected: {0}, Actual: {0}.", expectedFileList0.Last, actualFileList0.Last); //test get 0 GetFileListS String acutualFileID01 = meeting0.GetFileListS(); LinkedList <Int32> expectedFileList01 = new LinkedList <Int32>(); expectedFileList01.AddFirst(0); String expectedFileID01 = expectedFileList01.First.Value.ToString(); Assert.AreEqual(expectedFileID01, acutualFileID01, "Actual First FileID does not equal to 0, Expected: " + expectedFileID01 + " Actual: " + acutualFileID01); //test get GetFileList meeting.AddFiles(1); LinkedList <Int32> actualFileList2 = meeting.GetFileList(); LinkedList <Int32> expectedFileList2 = new LinkedList <Int32>(); expectedFileList2.AddFirst(1); Assert.AreEqual(expectedFileList2.First.Value, actualFileList2.First.Value, "Actual FileList does not contain 1"); //test get GetFileListS String acutualFileID02 = meeting.GetFileListS(); LinkedList <Int32> expectedFileList02 = new LinkedList <Int32>(); expectedFileList02.AddFirst(1); String expectedFileID02 = expectedFileList02.First.Value.ToString(); Assert.AreEqual(expectedFileID02, acutualFileID02, "Actual First FileID does not equal to 1"); //test add Filelist meeting.AddFiles(2); meeting.AddFiles(3); LinkedList <Int32> actualFileList3 = meeting.GetFileList(); LinkedList <Int32> expectedFileList3 = new LinkedList <Int32>(); expectedFileList3.AddLast(1); expectedFileList3.AddLast(2); expectedFileList3.AddLast(3); for (int n = 0; n < actualFileList3.Count; n++) { if (n == 0) { Assert.AreEqual(expectedFileList3.First.Value, actualFileList3.First.Value, "1st element in two lists are not equal"); } if (n == 1) { Assert.AreEqual(expectedFileList3.First.Next.Value, actualFileList3.First.Next.Value, "2nd element in two lists are not equal"); } if (n == 2) { Assert.AreEqual(expectedFileList3.First.Next.Next.Value, actualFileList3.First.Next.Next.Value, "3rd element in two lists are not equal"); } } //test set Filelist meeting0.FileList.Clear(); meeting0.SetFiles("1;2;3"); LinkedList <Int32> actualFileList4 = meeting0.GetFileList(); LinkedList <Int32> expectedFileList4 = new LinkedList <Int32>(); expectedFileList4.AddLast(1); expectedFileList4.AddLast(2); expectedFileList4.AddLast(3); for (int n = 0; n < actualFileList4.Count; n++) { if (n == 0) { Assert.AreEqual(expectedFileList4.First.Value, actualFileList4.First.Value, "1st element in two lists are not equal"); } if (n == 1) { Assert.AreEqual(expectedFileList4.First.Next.Value, actualFileList4.First.Next.Value, "2nd element in two lists are not equal"); } if (n == 2) { Assert.AreEqual(expectedFileList4.First.Next.Next.Value, actualFileList4.First.Next.Next.Value, "3rd element in two lists are not equal"); } } }