Example #1
0
        public void Convert_DataTypes_ToString()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            newlist.Add(34);
            //Act
            string result = newlist.ToString();

            //Assert
            Assert.AreEqual(result, "34");
        }
Example #2
0
        public void ToString_CanIntCovert_InttoString()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>();
            string expected            = "327645";
            string actual;

            //Act
            mylist.Add(32);
            mylist.Add(76);
            mylist.Add(45);
            actual = mylist.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void String_Add_ToString()
        {
            //Arrange
            NewCustomList <string> newlist = new NewCustomList <string>();

            newlist.Add("Hello");
            newlist.Add("World");
            newlist.Add("To");
            newlist.Add("Go");
            newlist.Add("Cart");
            //Act
            string actual   = newlist.ToString();
            string expected = "HelloWorldToGoCart";

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void ToString_CanCovertDouble()
        {
            //Arrange
            NewCustomList <double> mylist = new NewCustomList <double>();
            string expected = "1.51.41.61.7";
            string actual;

            //Act
            mylist.Add(1.5);
            mylist.Add(1.4);
            mylist.Add(1.6);
            mylist.Add(1.7);
            actual = mylist.ToString();

            //Asssert
            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public void ToString_CanCombineString()
        {
            //Arrange
            NewCustomList <string> mylist = new NewCustomList <string>();
            string expected = "David Michel Brett Paul";
            string actual;

            //Act
            mylist.Add("David ");
            mylist.Add("Michel ");
            mylist.Add("Brett ");
            mylist.Add("Paul");
            actual = mylist.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Example #6
0
        public void TestSort_ListOfUnsortedList_OutputInSortedOrder()
        {
            // Arrange
            NewCustomList <int> expectedresult = new NewCustomList <int>()
            {
                1, 2, 3, 4, 5, 6, 7
            };
            NewCustomList <int> s = new NewCustomList <int>()
            {
                5, 3, 7, 2, 6, 4, 1
            };

            // Act
            NewCustomList <int> actualresult = NewCustomList <int> .Sort <int>(s);

            // Assert
            Assert.AreEqual(expectedresult.ToString(), actualresult.ToString());;
        }
Example #7
0
        public void Test_Overloading_SubstactionOperator()
        {
            //Arrange
            NewCustomList <int> list = new NewCustomList <int>()
            {
                1, 3, 5
            };
            NewCustomList <int> secondList = new NewCustomList <int>()
            {
                2, 1, 6, 7, 8
            };
            NewCustomList <int> expectedResult = new NewCustomList <int>()
            {
                3, 5
            };

            //Act
            NewCustomList <int> actualresult = (list - secondList);

            //Assert
            Assert.AreEqual(expectedResult.ToString(), actualresult.ToString());
        }
Example #8
0
        public void Test_OfTwoCustomListZIP()
        {
            //Arrange
            NewCustomList <int> oddlist = new NewCustomList <int>()
            {
                1, 3, 5
            };
            NewCustomList <int> evenlist = new NewCustomList <int>()
            {
                2, 4, 6
            };

            //Act
            NewCustomList <int> expectedresult = new NewCustomList <int>()
            {
                1, 2, 3, 4, 5, 6
            };
            NewCustomList <int> actual = NewCustomList <int> .Zip(oddlist, evenlist);

            //Assert
            Assert.AreEqual(expectedresult.ToString(), actual.ToString());
        }
Example #9
0
        public void Test_Overloading_PlusOperator()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>()
            {
                1, 2
            };

            NewCustomList <int> secondList = new NewCustomList <int>()
            {
                3, 4
            };
            NewCustomList <int> expectdResult = new NewCustomList <int>()
            {
                1, 2, 3, 4
            };
            //Act
            NewCustomList <int> actualresult = (newlist + secondList);

            //Assert
            Assert.AreEqual(expectdResult.ToString(), actualresult.ToString());
        }
Example #10
0
        public void Zip_CanZipListInt()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>()
            {
                1, 2, 3
            };
            NewCustomList <int> mylist2 = new NewCustomList <int>()
            {
                4, 5, 6
            };
            NewCustomList <int> expected = new NewCustomList <int>()
            {
                1, 4, 2, 5, 3, 6
            };
            NewCustomList <int> actual;

            //Act
            actual = NewCustomList <int> .Zip(mylist, mylist2);

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #11
0
        public void PlusOperator_CanAddListofInt()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>()
            {
                123
            };
            NewCustomList <int> mylist2 = new NewCustomList <int>()
            {
                456
            };
            NewCustomList <int> expected = new NewCustomList <int>()
            {
                123456
            };
            NewCustomList <int> actual;

            //Act
            actual = mylist + mylist2;

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #12
0
        public void Zip_CanZipListString()
        {
            //Arrange
            NewCustomList <string> mylist = new NewCustomList <string>()
            {
                "Sunny", "Rain", "Sleet"
            };
            NewCustomList <string> mylist2 = new NewCustomList <string>()
            {
                "Windy", "Wet", "Stormy"
            };
            NewCustomList <string> expected = new NewCustomList <string>()
            {
                "Sunny", "Windy", "Rain", "Wet", "Sleet", "Stormy"
            };
            NewCustomList <string> actual;

            //Act
            actual = NewCustomList <string> .Zip(mylist, mylist2);

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #13
0
        public void PlusOperator_CanAddListOfString()
        {
            //Arrange
            NewCustomList <string> mylist = new NewCustomList <string>()
            {
                "Bad,Bears,Live"
            };
            NewCustomList <string> mylist2 = new NewCustomList <string>()
            {
                ",In,Black,Woods"
            };
            NewCustomList <string> expected = new NewCustomList <string>()
            {
                "Bad,Bears,Live,In,Black,Woods"
            };
            NewCustomList <string> actual;

            //Act
            actual = mylist + mylist2;

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #14
0
        public void MinusOperator_CanSubtractListofInt()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>()
            {
                1, 2, 3, 4, 5, 6
            };
            NewCustomList <int> mylist2 = new NewCustomList <int>()
            {
                4, 5, 6
            };
            NewCustomList <int> expected = new NewCustomList <int>()
            {
                1, 2, 3
            };
            NewCustomList <int> actual;

            //Act
            actual = mylist - mylist2;

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #15
0
        public void Minusoperator_CanSubtractListString()
        {
            //Arrange
            NewCustomList <string> mylist = new NewCustomList <string>()
            {
                "Sunny", "Rain", "Sleet", "Snow"
            };
            NewCustomList <string> mylist2 = new NewCustomList <string>()
            {
                "Sunny", "Rain", "Stormy", "Hail"
            };
            NewCustomList <string> expected = new NewCustomList <string>()
            {
                "Sleet", "Snow"
            };
            NewCustomList <string> actual;

            //Act
            actual = mylist - mylist2;

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #16
0
        public void Zip_CanZipListDpouble()
        {
            //Arrange
            NewCustomList <double> mylist = new NewCustomList <double>()
            {
                1.1, 1.2, 1.3, 1.4
            };
            NewCustomList <double> mylist2 = new NewCustomList <double>()
            {
                1.5, 1.6
            };
            NewCustomList <double> expected = new NewCustomList <double>()
            {
                1.1, 1.5, 1.2, 1.6, 1.3, 1.4
            };
            NewCustomList <double> actual;

            //Act

            actual = NewCustomList <double> .Zip(mylist, mylist2);

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #17
0
        public void PlusOperator_CanAddListofDoublbe()
        {
            //Arrange
            NewCustomList <double> mylist = new NewCustomList <double>()
            {
                1.2, 1.3, 1.4, 1.5
            };
            NewCustomList <double> mylist2 = new NewCustomList <double>()
            {
                1.6, 1.7, 1.8, 1.9
            };
            NewCustomList <double> expected = new NewCustomList <double>()
            {
                1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9
            };
            NewCustomList <double> actual;

            //Act

            actual = mylist + mylist2;

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Example #18
0
        public void Minusoperator_CanSubtractListDouble()
        {
            //Arrange
            NewCustomList <double> mylist = new NewCustomList <double>()
            {
                1.1, 1.2, 1.3, 1.4
            };
            NewCustomList <double> mylist2 = new NewCustomList <double>()
            {
                1.1, 1.5, 1.6, 1.7
            };
            NewCustomList <double> expected = new NewCustomList <double>()
            {
                1.2, 1.3, 1.4
            };
            NewCustomList <double> actual;

            //Act

            actual = mylist - mylist2;

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