예제 #1
0
        [TestMethod]//18
        public void OverloadSubtractionOfLists_CheckCount_TwoListsOfStrings()
        {
            // arrange

            ListB <string> listB        = new ListB <string>();
            ListB <string> listA        = new ListB <string>();
            ListB <string> combinedList = new ListB <string>();
            int            expected     = 2;
            int            actual;

            //act
            listB.Add("B");
            listB.Add("e");
            listB.Add("n");
            listA.Add("B");
            listA.Add("a");
            listA.Add("m");
            listA.Add("i");
            listA.Add("p");

            combinedList = listB - listA;



            actual = combinedList.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        [TestMethod]//20
        public void OverloadSubtractionOfLists_CheckCountOfOriginalList_TwoListsOfInts()
        {
            // arrange

            ListB <int> listB        = new ListB <int>();
            ListB <int> listA        = new ListB <int>();
            ListB <int> combinedList = new ListB <int>();
            int         expected     = 3;
            int         actual;

            //act
            listB.Add(1);
            listB.Add(2);
            listB.Add(3);
            listA.Add(1);
            listA.Add(4);
            listA.Add(5);
            listA.Add(6);
            listA.Add(7);

            combinedList = listB - listA;



            actual = listB.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        [TestMethod]//15
        public void OverloadAdditionOfLists_CheckCount_TwoListsOfIntegers()
        {
            // arrange

            ListB <int> listB        = new ListB <int>();
            ListB <int> listA        = new ListB <int>();
            ListB <int> combinedList = new ListB <int>();
            int         expected     = 8;
            int         actual;

            //act
            listB.Add(3);
            listB.Add(9);
            listB.Add(55);
            listA.Add(22);
            listA.Add(23);
            listA.Add(24);
            listA.Add(25);
            listA.Add(26);

            combinedList = listB + listA;



            actual = combinedList.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        [TestMethod]//23
        public void Zip_CheckArrayOrder_TwoListsOfStrings()
        {
            // arrange

            ListB <string> listB      = new ListB <string>();
            ListB <string> listA      = new ListB <string>();
            ListB <string> zippedList = new ListB <string>();
            string         expected   = "R";
            string         actual;

            //act
            listB.Add("A");
            listB.Add("B");
            listB.Add("C");
            listB.Add("D");
            listA.Add("Z");
            listA.Add("R");
            listA.Add("S");
            listA.Add("T");
            listA.Add("U");

            zippedList = listB.Zip(listA);



            actual = zippedList[3];


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        [TestMethod]//22
        public void Zip_CheckCount_TwoListsOfStrings()
        {
            // arrange

            ListB <string> listB      = new ListB <string>();
            ListB <string> listA      = new ListB <string>();
            ListB <string> zippedList = new ListB <string>();
            int            expected   = 9;
            int            actual;

            //act
            listB.Add("A");
            listB.Add("A");
            listB.Add("A");
            listB.Add("A");
            listA.Add("A");
            listA.Add("A");
            listA.Add("A");
            listA.Add("A");
            listA.Add("A");

            zippedList = listB.Zip(listA);



            actual = zippedList.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void OverloadAdditionOfLists_CheckCount_TwoListsOfStrings()
        {
            // arrange

            ListB<string> listB = new ListB<string>();
            ListB<string> listA = new ListB<string>();
            ListB<string> combinedList = new ListB<string>();
            int expected = 8;
            int actual;

            //act
            listB.Add("J");
            listB.Add("e");
            listB.Add("f");
            listA.Add("f");
            listA.Add("r");
            listA.Add("e");
            listA.Add("y");
            listA.Add("C");

            combinedList = listB + listA;



            actual = combinedList.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        [TestMethod]//23
        public void Zip_CheckArrayOrder_TwoListsOfInts()
        {
            // arrange

            ListB <int> listB      = new ListB <int>();
            ListB <int> listA      = new ListB <int>();
            ListB <int> zippedList = new ListB <int>();
            int         expected   = 5;
            int         actual;

            //act
            listB.Add(1);
            listB.Add(7);
            listB.Add(9);
            listB.Add(2);
            listA.Add(4);
            listA.Add(8);
            listA.Add(5);
            listA.Add(6);
            listA.Add(5);

            zippedList = listB.Zip(listA);



            actual = zippedList[5];


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #8
0
        [TestMethod]//21
        public void Zip_CheckCount_TwoListsOfInts()
        {
            // arrange

            ListB <int> listB      = new ListB <int>();
            ListB <int> listA      = new ListB <int>();
            ListB <int> zippedList = new ListB <int>();
            int         expected   = 9;
            int         actual;

            //act
            listB.Add(1);
            listB.Add(2);
            listB.Add(3);
            listB.Add(5);
            listA.Add(1);
            listA.Add(4);
            listA.Add(5);
            listA.Add(6);
            listA.Add(7);

            zippedList = listB.Zip(listA);



            actual = zippedList.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #9
0
        [TestMethod]//17
        public void OverloadAdditionOfLists_CheckArrayOrderAfterCombining_TwoListsOfStrings()
        {
            // arrange

            ListB <string> listB        = new ListB <string>();
            ListB <string> listA        = new ListB <string>();
            ListB <string> combinedList = new ListB <string>();
            string         expected     = "m";
            string         actual;

            //act
            listB.Add("B");
            listB.Add("e");
            listB.Add("n");
            listA.Add("j");
            listA.Add("a");
            listA.Add("m");
            listA.Add("i");
            listA.Add("n");

            combinedList = listB + listA;



            actual = combinedList[5];


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #10
0
        public void Indexer_CheckForExceptionCode()
        {
            ListB <int> listB = new ListB <int>();



            //act
            listB.Add(23);
            listB.Add(33);
            listB.Add(43);
            listB.Add(38);
            listB.Add(55);

            Console.WriteLine($"{listB[7]}");

            //assert
        }
예제 #11
0
        [TestMethod]//6
        public void Remove_CheckCount_RemoveOneValue()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         expected = 2;
            int         actual;

            //act
            listB.Add(24);
            listB.Add(12);
            listB.Add(56);
            listB.Remove(12);
            actual = listB.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #12
0
        [TestMethod]//3
        public void Add_CheckIfNewArrayIsMade_Add5thElement()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         value    = 23;
            int         expected = 8;
            int         actual;

            //act
            listB.Add(value);
            listB.Add(value + 10);
            listB.Add(value + 20);
            listB.Add(value + 15);
            listB.Add(value + 32);
            actual = listB.Capacity;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #13
0
        public void ToString_CheckCoversion_ListOfDoubles()
        {
            // arrange

            ListB<double> listB = new ListB<double>();
            string expected = "56.323.21";
            string actual;

            //act
            listB.Add(56.32);
            listB.Add(3.21);




            actual = listB.ToString();


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #14
0
        [TestMethod]//11
        public void Remove_CheckCount_RemoveAValueThatHasADuplicateValue()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         expected = 3;
            int         actual;

            //act
            listB.Add(24);
            listB.Add(12);
            listB.Add(24);
            listB.Add(33);
            listB.Remove(24);

            actual = listB.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #15
0
        [TestMethod]//5
        public void Add_CheckArrayOrderStayedSame_Add5thElement()
        {
            // arrange

            ListB <int> listB = new ListB <int>();

            int expected = 43;
            int actual   = 0;

            //act
            listB.Add(23);
            listB.Add(33);
            listB.Add(43);
            listB.Add(38);
            listB.Add(55);


            actual = listB[2];
            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #16
0
        [TestMethod]//4
        public void Add_CheckListCount_Add5thElement()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         value    = 23;
            int         expected = 5;
            int         actual;

            //act
            listB.Add(value);
            listB.Add(value + 10);
            listB.Add(value + 20);
            listB.Add(value + 15);
            listB.Add(value + 32);
            actual = listB.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #17
0
        [TestMethod]//13
        public void ToString_CheckCoversion_ListOfIntegers()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            string      expected = "3456";
            string      actual;

            //act
            listB.Add(3);
            listB.Add(4);
            listB.Add(5);
            listB.Add(6);



            actual = listB.ToString();


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #18
0
        [TestMethod]//14
        public void ToString_CheckCoversion_ListOfStrings()
        {
            // arrange

            ListB <string> listB    = new ListB <string>();
            string         expected = "BenJ";
            string         actual;

            //act
            listB.Add("B");
            listB.Add("e");
            listB.Add("n");
            listB.Add("J");



            actual = listB.ToString();


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #19
0
        [TestMethod]//2
        public void Add_CheckCount_AddPositiveNumber()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         value    = 23;
            int         expected = 1;
            int         actual;

            //act
            listB.Add(value);
            actual = listB.Count;


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #20
0
        [TestMethod]//8
        public void Remove_CheckIndexOrder_RemoveMiddleValue()
        {
            // arrange

            ListB <int> listB    = new ListB <int>();
            int         expected = 3;
            int         actual;

            //act
            listB.Add(24);
            listB.Add(12);
            listB.Add(56);
            listB.Add(2);
            listB.Add(3);
            listB.Add(53);
            listB.Remove(2);
            actual = listB[3];


            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #21
0
        public void ToString_CheckCoversion_ListOfStrings()
        {
            // arrange

            ListB<string> listB = new ListB<string>();
            string expected = "Packers Suck";
            string actual;

            //act
            listB.Add("P");
            listB.Add("a");
            listB.Add("c");
            listB.Add("k");
            listB.Add("e");
            listB.Add("r");
            listB.Add("s");
            listB.Add(" ");
            listB.Add("S");
            listB.Add("u");
            listB.Add("c");
            listB.Add("k");


            actual = listB.ToString();


            //assert
            Assert.AreEqual(expected, actual);
        }