Exemple #1
0
        public void Add_String()
        {
            //Arrange
            NewCustomList <string> newlist = new NewCustomList <string>();
            string expectedResult          = "Test";

            newlist.Add("words");
            newlist.Add("Test");

            //assert
            Assert.AreEqual(expectedResult, newlist[1]);
        }
Exemple #2
0
        public void Add_Double()
        {
            //Arrange
            NewCustomList <double> newlist = new NewCustomList <double>();
            double expectedResult          = 19.55;

            //act
            newlist.Add(.32);
            newlist.Add(19.55);


            //assert
            Assert.AreNotEqual(expectedResult, newlist[0]);
        }
Exemple #3
0
        public void Remove_TestEndOfString()
        {
            //Arrange
            NewCustomList <string> newlist = new NewCustomList <string>();

            newlist.Add("Hi");
            newlist.Add("Hello");
            newlist.Add("Baby");
            newlist.Add("Hey");
            newlist.Add("Son");
            //Act
            newlist.Remove("Son");
            //Assert
            Assert.AreEqual("Son", newlist.LastElementRemoved);
        }
Exemple #4
0
        public void Remove_TestFirstInt()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            newlist.Add(1);
            newlist.Add(2);
            newlist.Add(3);
            newlist.Add(4);
            newlist.Add(5);
            //Act
            newlist.Remove(3);
            //Assert
            Assert.AreEqual(4, newlist[2]);
        }
Exemple #5
0
        public void Indexer_ElementOutOfRange()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            newlist.Add(1);
            newlist.Add(2);
            newlist.Add(3);
            newlist.Add(5);
            newlist.Add(6);

            //newlist[10];
            //Assert
            //  Assert.AreEqual();
        }
Exemple #6
0
        public void Add_IndexOne_CheckIfAddFillsIndexOne()
        {
            // Arrange
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 5;
            int actual;

            // Act
            mylist.Add(4);
            mylist.Add(5);
            actual = mylist[1];

            //  Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #7
0
        public void Add_IndexTwo_CheckIfAddFiilsIndexTwo()
        {
            //  Array
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 6;
            int actual;

            // Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            actual = mylist[2];

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #8
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);
        }
Exemple #9
0
        public void Remove_CheckRemov_CheckRemoveAtIndexOne()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 6;
            int actual;

            //Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            mylist.Remove(5);
            actual = mylist[1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #10
0
        public void Add_CheckingCount_CheckIfAddIncreasesCount()
        {
            //Array
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 4;
            int actual;

            //Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            mylist.Add(7);
            actual = mylist.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #11
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);
        }
Exemple #12
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);
        }
Exemple #13
0
        public void Removal_CheckCountAfterRemove()
        {
            //Arrange
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 2;
            int actual;

            //Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            mylist.Remove(5);
            actual = mylist.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #14
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);
        }
Exemple #15
0
        public void Add_CheckCount_CheckCountAfterAddToIndexFive()
        {
            //Array
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 5;
            int actual;

            //Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            mylist.Add(7);
            mylist.Add(8);
            actual = mylist.Count;

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

            newlist.Add("hello");
            newlist.Add("get");
            newlist.Add("A");
            newlist.Add("new");
            newlist.Add("job");

            string expected = "job";
            //Act
            string actual = newlist[4];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #17
0
        public void Add_CheckCapacity_CheckToSeeIfCapacityIsIncreased()
        {
            //Array
            NewCustomList <int> mylist = new NewCustomList <int>();
            int expected = 8;
            int actual;

            //Act
            mylist.Add(4);
            mylist.Add(5);
            mylist.Add(6);
            mylist.Add(7);
            mylist.Add(8);
            actual = mylist[4];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #18
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");
        }
Exemple #19
0
        public void AddTestLargeNumber()
        {
            //arrange
            //arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            //act
            newlist.Add(2147483647);
            int expectedResult = 2147483647;
            int actual         = newlist[0];

            //assert

            Assert.AreEqual(expectedResult, actual);
        }
Exemple #20
0
        public void TestMethod1Add_List()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            newlist.Add(5);
            newlist.Add(3);
            newlist.Add(5);
            newlist.Add(22);
            newlist.Add(50);
            newlist.Add(2);
            newlist.Add(100);
            //Act
            int expectedResult = 22;

            //assert
            Assert.AreEqual(expectedResult, newlist[3]);
        }
Exemple #21
0
        public void Add_IndexCpacity()
        {
            //Arrange
            NewCustomList <int> newlist = new NewCustomList <int>();

            newlist.Add(5);
            newlist.Add(3);
            newlist.Add(5);
            newlist.Add(22);
            newlist.Add(50);
            newlist.Add(2);
            newlist.Add(100);
            int expected = 10;
            //Act
            int actual = newlist.Capacity;

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