Exemplo n.º 1
0
        public void GetandAddMeetingListTest()
        {
            FileNode file0 = new FileNode(fileName, fileID, modifiedTime, createdTime, executeTime, extension, filePath);
            FileNode file = new FileNode(fileName, fileID, modifiedTime, createdTime, executeTime, extension, filePath);

            //test get empty list
            String actualmeetingList0 = file0.GetMeetingListS();
            Assert.AreEqual("", actualmeetingList0, "The actual meeting list is not empty");

            //test add string value
            file0.AddMeetings("01");
            String actualmeetingList2 = file0.GetMeetingListS();
            Assert.AreEqual("01", actualmeetingList2, "The string value 01 was not added into the list successfully");

            //test add int value
            file.AddMeetings(2);
            String actualmeetingList3 = file.GetMeetingListS();
            Assert.AreEqual("2", actualmeetingList3, "The int value 2 was not added into the list successfully");

            //test add multiple values
            file.AddMeetings("3");
            file.AddMeetings("4");
            LinkedList<String> actualmeetingList4 = file.GetMeetingList();
            LinkedList<String> expectedmeetingList4 = new LinkedList<String>();
            expectedmeetingList4.AddLast("2");
            expectedmeetingList4.AddLast("3");
            expectedmeetingList4.AddLast("4");
            for (int n = 0; n < actualmeetingList4.Count; n++)
            {
                if (n == 0)
                {
                    Assert.AreEqual(expectedmeetingList4.First.Value, actualmeetingList4.First.Value, "1st element in two lists are not equal");
                }
                if (n == 1)
                {
                    Assert.AreEqual(expectedmeetingList4.First.Next.Value, actualmeetingList4.First.Next.Value, "2nd element in two lists are not equal");
                }
                if (n == 2)
                {
                    Assert.AreEqual(expectedmeetingList4.First.Next.Next.Value, actualmeetingList4.First.Next.Next.Value, "3rd element in two lists are not equal");
                }
            }
        }
Exemplo n.º 2
0
        public void SetMeetingsTest()
        {
            FileNode file = new FileNode(fileName, fileID, modifiedTime, createdTime, executeTime, extension, filePath);

            //test set single element
            file.SetMeetings("2");
            LinkedList<String> actualmeetingList0 = file.GetMeetingList();
            String actualmeetingString0 = file.GetMeetingListS();
            LinkedList<String> expectedmeetingList0 = new LinkedList<String>();
            expectedmeetingList0.AddLast("2");
            Assert.AreEqual("2", actualmeetingString0, "Actual meeting list is not 2");
            Assert.AreEqual(expectedmeetingList0.Count, actualmeetingList0.Count, "the length of two lists are not equal to 1");
            Assert.AreEqual(expectedmeetingList0.First.Value, actualmeetingList0.First.Value, "the only element in two lists are not equal");

            //test set multiple elements
            file.SetMeetings("3;4;5");
            LinkedList<String> actualmeetingList1 = file.GetMeetingList();
            String actualmeetingString1 = file.GetMeetingListS();
            LinkedList<String> expectedmeetingList1 = new LinkedList<String>();
            expectedmeetingList1.AddLast("3");
            expectedmeetingList1.AddLast("4");
            expectedmeetingList1.AddLast("5");
            Assert.AreEqual("3;4;5", actualmeetingString1, "Actual meeting list is not 3;4;5");
            Assert.AreEqual(expectedmeetingList1.Count, actualmeetingList1.Count, "the length of two lists are not equal to 3");
            for (int n = 0; n < actualmeetingList1.Count; n++)
            {
                if (n == 0)
                {
                    Assert.AreEqual(expectedmeetingList1.First.Value, actualmeetingList1.First.Value, "1st element in two lists are not equal");
                }
                if (n == 1)
                {
                    Assert.AreEqual(expectedmeetingList1.First.Next.Value, actualmeetingList1.First.Next.Value, "2nd element in two lists are not equal");
                }
                if (n == 2)
                {
                    Assert.AreEqual(expectedmeetingList1.First.Next.Next.Value, actualmeetingList1.First.Next.Next.Value, "3rd element in two lists are not equal");
                }
            }
        }