Пример #1
0
        public void NewList_ZipLists_LongerLists()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            odd.Add(7);
            odd.Add(9);
            odd.Add(11);
            odd.Add(13);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            even.Add(8);
            even.Add(10);
            even.Add(12);
            even.Add(14);
            NewList<int> three = odd.Zip(even);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void NewList_SubtractedList2_Operator()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            string expected = "5";
            string actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            one.Add(6);
            one.Add(8);

            two.Add(2);
            two.Add(1);
            two.Add(6);
            two.Add(11);
            two.Add(7);
            two.Add(8);
            two.Add(3);
            NewList<int> three = one - two;
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
 public void NewList_CheckString_StringToString()
 {
     //arrange
     NewList<string> list = new NewList<string>();
     string expected = "Charles, King, Mangos";
     string actual;
     //act
     list.Add("Charles");
     list.Add("King");
     list.Add("Mangos");
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }
Пример #4
0
 public void NewList_CheckString_IntsToString()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     string expected = "5, 10, 15";
     string actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }
Пример #5
0
        public void NewList_ZipLists_EvensOdds()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "2, 1, 4, 3, 6, 5";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            NewList<int> three = even.Zip(odd);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #6
0
        public void NewList_ZipLists_OddsEvens()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "1, 2, 3, 4, 5, 6";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            NewList<int> three = odd.Zip(even);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #7
0
        public void NewList_CheckCombinedList_Operator()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            string expected = "1, 3, 5, 2, 4, 6";
            string actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            two.Add(2);
            two.Add(4);
            two.Add(6);
            NewList<int> three = one + two;
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #8
0
 public void NewList_CheckString_IntsToStringRemoved()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     string expected = "5, 15, 20, 25, 30, 40, 45, 10";
     string actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     list.Add(30);
     list.Add(35);
     list.Add(40);
     list.Remove(35);
     list.Add(45);
     list.Remove(10);
     list.Add(10);
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }