예제 #1
0
        public void Add_ValueAt_Index0() //int value of 5 expected at index 0
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int expected            = 5;

            //Act
            thing.Add(5);

            int actual = thing[0]; //c# indexer

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Add_CountAt_Index1()
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int expected            = 1;

            //Act
            thing.Add(5);

            int actual = thing.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void Add_TwoPositiveValues_returnPostiveSum()
        {
            //arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int value1   = 7;
            int expected = 7;
            int actual;

            //act
            thing.Add(value2);
            actual = thing[0];
            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void Add_ValueAt_Index1() //int value 10 expected at index 1
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int expected            = 10;

            //Act
            thing.Add(5);
            thing.Add(10);


            int actual = thing[1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        public void Remove_Method_Test2()
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int expected            = 0;

            //Act
            thing.Add(5);
            thing.Add(10);
            thing.Add(15);
            thing.Add(20);

            thing.Remove(20);

            int actual = thing[4];

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void Remove_ItemShifted()
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>();
            int expected            = 10;

            //Act
            thing.Add(5);
            thing.Add(10);
            thing.Add(15);
            thing.Add(20);

            thing.Remove(5);

            int actual = thing[0];

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public void TestMethod5()//Checking capactiy
        {
            //Arrange
            CustomList1 <int> thing = new CustomList1 <int>(25);
            int expected            = 8;

            //Act
            thing.Add(5);
            thing.Add(10);
            thing.Add(15);
            thing.Add(20);
            thing.Add(25);

            int actual = thing.Capacity;


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