예제 #1
0
        public void Zip2Lines_PositiveZip_CorrectStringOrder()
        {
            //arrange
            CList <string> list1 = new CList <string> {
            };
            CList <string> list2 = new CList <string> {
            };
            string new1String    = "1";
            string new2String    = "2";
            string new3String    = "3";
            string new4String    = "4";
            string new5String    = "5";
            string new6String    = "6";

            list1.Add(new1String);
            list1.Add(new2String);
            list1.Add(new3String);
            list2.Add(new4String);
            list2.Add(new5String);
            list2.Add(new6String);
            //act
            CList <string> list3      = list1.Zip(list2);
            string         testString = list3.ToString();

            //assert
            Assert.AreEqual("142536", testString);
        }
예제 #2
0
        public void Zip2Lines_PositiveZip_CorrectCount()
        {
            //arrange
            CList <int> list1 = new CList <int> {
            };
            CList <int> list2 = new CList <int> {
            };
            int new1Int       = 1;
            int new2Int       = 2;
            int new3Int       = 3;
            int new4Int       = 4;
            int new5Int       = 5;
            int new6Int       = 6;

            list1.Add(new1Int);
            list1.Add(new2Int);
            list1.Add(new3Int);
            list2.Add(new4Int);
            list2.Add(new5Int);
            list2.Add(new6Int);
            //act
            CList <int> list3      = list1.Zip(list2);
            string      testString = list3.ToString();

            //assert
            Assert.AreEqual(list3.Count, 6);
        }
예제 #3
0
        public void Reduce2Lists_PositiveTest_Same1List()
        {
            //arrange
            CList <int> list1 = new CList <int> {
            };
            CList <int> list2 = new CList <int> {
            };
            int new1Int       = 1;
            int new2Int       = 2;
            int new3Int       = 3;
            int new4Int       = 4;
            int new5Int       = 5;
            int new6Int       = 6;

            list1.Add(new1Int);
            list1.Add(new2Int);
            list1.Add(new3Int);
            list2.Add(new4Int);
            list2.Add(new5Int);
            list2.Add(new6Int);
            //act
            string      test1String = list1.ToString();
            string      test2String = list2.ToString();
            CList <int> list3       = list1 - list2;
            string      test3String = list3.ToString();

            //assert
            Assert.AreEqual(test3String, test1String);
        }
예제 #4
0
        public void Reduce2ListsWIthInt_PositiveTest_Different1List()
        {
            //arrange
            CList <string> list1 = new CList <string> {
            };
            CList <string> list2 = new CList <string> {
            };
            string new1String    = "1";
            string new2String    = "2";
            string new3String    = "3";
            string new4String    = "4";
            string new5String    = "5";
            string new6String    = "6";

            list1.Add(new1String);
            list1.Add(new2String);
            list1.Add(new3String);
            list2.Add(new4String);
            list2.Add(new5String);
            list2.Add(new6String);
            //act
            string         test1Int = list1.ToString();
            string         test2Int = list2.ToString();
            CList <string> list3    = list1 - list2;
            string         test3Int = list3.ToString();

            //assert
            Assert.AreEqual(test3Int, test1Int);
        }
예제 #5
0
        public void ListToStringTestMethod()
        {
            //arrange
            CList <CList <string> > storedList    = new CList <CList <string> >();
            CList <string>          storedInts    = new CList <string>();
            CList <string>          storedStrings = new CList <string>();
            string testString;
            string resultString;

            storedInts.Add("1");
            storedInts.Add("2");
            storedInts.Add("3");
            storedInts.Add("4");
            storedInts.Add("5");

            storedStrings.Add("This");
            storedStrings.Add("Is");
            storedStrings.Add("A");
            storedStrings.Add("Test");
            storedStrings.Add(".");

            storedList.Add(storedInts);
            storedList.Add(storedStrings);

            testString = "1,2,3,4,5,This,Is,A,Test,.";

            //act
            resultString = storedList.ToString();
            //assert
            Assert.AreEqual(testString, resultString);
        }
예제 #6
0
    public static void Main()
    {
        var list2 = new CList <int>();

        list2.Add(1000);
        list2.Add(2000);
        Console.WriteLine(list2.ToString());
    }
예제 #7
0
        public void TestListPopFront()
        {
            CList <string> l1 = new CList <string>();

            l1.Append("abcd");
            l1.Append("qwerty");
            l1.Append("hello");
            l1.Append("world");
            l1.PopFront();
            Assert.AreEqual(l1.Length, 3);
            Assert.AreEqual("[qwerty, hello, world]", l1.ToString());
        }
예제 #8
0
        public void TestListClear()
        {
            CList <int> l1 = new CList <int>();

            for (int i = 1; i <= 10; i++)
            {
                l1.Append(i);
            }
            l1.Clear();
            Assert.AreEqual(l1.Length, 0);
            Assert.AreEqual("[]", l1.ToString());
        }
예제 #9
0
        public void ConvertToSTring_PositiveTest_StringVersion()
        {
            //arrange
            CList <int> list = new CList <int> {
            };
            int new1Int      = 1;

            list.Add(new1Int);
            //act
            string testString = list.ToString();

            //assert
            Assert.AreEqual("1", testString);
        }
예제 #10
0
        public void TestListCopyCtor()
        {
            CList <int> l1 = new CList <int>();

            for (int i = 1; i <= 10; i++)
            {
                l1.Append(i);
            }
            CList <int> l2 = new CList <int>(l1);

            Assert.AreEqual(l1.Length, l2.Length);
            Assert.AreEqual(l2.Length, 10);
            Assert.AreEqual("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", l2.ToString());
        }
예제 #11
0
        public void ConvertStringsToSTring_PositiveTest_StringVersion()
        {
            //arrange
            CList <string> list = new CList <string> {
            };
            string new1String   = "1";
            string new2String   = "2";
            string new3String   = "3";

            list.Add(new1String);
            list.Add(new2String);
            list.Add(new3String);
            //act
            string testString = list.ToString();

            //assert
            Assert.AreEqual("123", testString);
        }
예제 #12
0
        public void TestListExtend()
        {
            CList <int> l1 = new CList <int>();

            for (int i = 1; i <= 5; i++)
            {
                l1.Append(i);
            }
            CList <int> l2 = new CList <int>();

            for (int i = 6; i <= 12; i++)
            {
                l2.Append(i);
            }
            l1.Extend(l2);
            Assert.AreEqual(l1.Length, 12);
            Assert.AreEqual("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]", l1.ToString());
        }
예제 #13
0
        public void StringToStringTestMethod()
        {
            //arrange
            CList <string> storedStrings = new CList <string>();
            string         testString;
            string         resultString;

            storedStrings.Add("This");
            storedStrings.Add("Is");
            storedStrings.Add("A");
            storedStrings.Add("Test");
            storedStrings.Add(".");

            testString = "This,Is,A,Test,.";
            //act
            resultString = storedStrings.ToString();
            //assert
            Assert.AreEqual(testString, resultString);
        }
예제 #14
0
        public void IntToStringTestMethod()
        {
            //arrange
            CList <int> storedInts = new CList <int>();
            string      testString;
            string      resultString;

            storedInts.Add(1);
            storedInts.Add(2);
            storedInts.Add(3);
            storedInts.Add(4);
            storedInts.Add(5);

            testString = "1,2,3,4,5";
            //act
            resultString = storedInts.ToString();
            //assert
            Assert.AreEqual(testString, resultString);
        }