Ejemplo n.º 1
0
        public void SubtractOverload_IndexCheck_MakingSureValuesAreAtProperIndex()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;

            int expected = 3;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList2.Add(value2);

            TheCustomList <int> result = myList - myList2;

            actual = result[1];

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void PlusOverload_ReportOutValues_EachValueIsAtExpectedIndex()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;

            int expected1 = 1;
            int actual1;
            int expected2 = 2;
            int actual2;
            int expected3 = 3;
            int actual3;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList2.Add(value3);

            TheCustomList <int> result = myList + myList2;

            actual1 = result[0];
            actual2 = result[1];
            actual3 = result[2];

            //Assert
            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
            Assert.AreEqual(expected3, actual3);
        }
Ejemplo n.º 3
0
        public void SubtractOverload_CapacityCheck_MakingSureCapacityDoesntIncreaseAfterRemoval()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;

            int expected = 4;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList2.Add(value2);

            TheCustomList <int> result = myList - myList2;

            actual = result.Capacity;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TestMethod1_CountCheck_TakesValuesInBothListsAndAddsThemToNewListInOrderOfIndex()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            TheCustomList <int> myList3 = new TheCustomList <int>();

            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;

            int expected = 5;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value3);
            myList.Add(value5);
            myList2.Add(value2);
            myList2.Add(value4);


            myList3 = myList3.ListZipper(myList, myList2);
            actual  = myList3.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void PlusOverload_FirstIndexChecker_MakingSureTheFirstIndexRemainsTheSame()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;

            int expected = 1;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList2.Add(value3);


            TheCustomList <int> result = myList + myList2;

            actual = result[0];

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TestMethod1_ZipsBothListsWithDifferentValueAmounts_TakesValuesInBothListsAndAddsThemToNewListInOrderOfIndex()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            TheCustomList <int> myList3 = new TheCustomList <int>();

            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;

            string expected = "1 2 3 4 5";
            string actual;

            //Act
            myList.Add(value1);
            myList.Add(value3);
            myList.Add(value5);
            myList2.Add(value2);
            myList2.Add(value4);


            myList3 = myList3.ListZipper(myList, myList2);
            actual  = myList3.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void PlusOverload_CountTest_MakingSureTheCountIsIncreased()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;
            int value6 = 6;

            int expected = 6;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList2.Add(value4);
            myList2.Add(value5);
            myList2.Add(value6);

            TheCustomList <int> result = myList + myList2;

            actual = result.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
        public void PlusOverload_CapacityOfNewList_CombinedListCapacityIncreasedAfterCombining()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;

            int expected = 8;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList2.Add(value4);
            myList2.Add(value5);

            TheCustomList <int> result = myList + myList2;

            actual = result.Capacity;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TestMethod1_CapacityCheck_MakingSureCapacityIsIncreasedInNewList()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            TheCustomList <int> myList3 = new TheCustomList <int>();

            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;

            int expected = 8;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value3);
            myList.Add(value5);
            myList2.Add(value2);
            myList2.Add(value4);


            myList3 = myList3.ListZipper(myList, myList2);
            actual  = myList3.Capacity;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 10
0
        public void SubtractOverload_SubractTwoValues_RemoveTwoValuesFromOriginalList()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;

            int expected = 2;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList2.Add(value1);
            myList2.Add(value2);
            myList2.Add(value5);

            TheCustomList <int> result = myList - myList2;

            actual = result.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 11
0
        public void SubtractOverload_CheckCount_MakingSureTheCountEqualsTheRemainingVariables()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;
            int value6 = 6;

            int expected = 5;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);
            myList.Add(value6);
            myList2.Add(value2);

            TheCustomList <int> result = myList - myList2;

            actual = result.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 12
0
        public void Add_SpecificNumbers_ExpectingTheIndexToEqualASpecificInteger()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int expected   = 5;
            int fillValue1 = 7;
            int fillValue2 = 11;

            //Act
            myList.Add(expected);
            myList.Add(fillValue1);
            myList.Add(fillValue2);

            //Assert
            Assert.AreEqual(expected, myList[0]);
        }
        public void ToStringOverride_CreateAListOfDoublesAndGetAString_TakesAListAndOutputsAllValuesAsAString()
        {
            //Arrange
            TheCustomList <double> myList = new TheCustomList <double>();
            double value1 = 1.1;
            double value2 = 2.2;

            string expected = "1.1 2.2";
            string actual   = "";

            //Act
            myList.Add(value1);
            myList.Add(value2);

            actual = myList.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Remove_RemovingAnObject_RemoveAnObjectAtSpecifiedIndex()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;

            int expected = 1;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);

            myList.Remove(value2);
            actual = myList.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 15
0
        public void Add_ExpectingAValue_ExpectingASpecificValueAddedToTheList()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int expected = 5;

            //Act
            myList.Add(expected);

            //Assert
            Assert.AreEqual(expected, myList[0]);
        }
Ejemplo n.º 16
0
        public void Add_AddingNegativeNumbers_BeingAbleToAddNegativeNumbersInTheList()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int expected = -10;

            //Act
            myList.Add(expected);

            //Assert
            Assert.AreEqual(expected, myList[0]);
        }
Ejemplo n.º 17
0
        public void Add_OneValue_ListCountIncrement()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int expected = 1;

            //Act
            myList.Add(5);

            //Assert
            Assert.AreEqual(expected, myList.Count);
        }
Ejemplo n.º 18
0
        public void Add_CapacityIncrease_MakingSureThatTheCapcityIncreasesInTheListAndKeepsOriginalValues()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;
            int value6 = 6;

            int expectedListCount = 6;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);
            myList.Add(value6);


            //Assert
            Assert.AreEqual(expectedListCount, myList[5]);
        }
        public void Remove_RemovingAnObjectExpandedArray_RemovingAnObjectInAExpandedArray()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;
            int value5 = 5;
            int value6 = 6;

            int expected = 6;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);
            myList.Add(value6);

            myList.Remove(value5);

            //Assert
            Assert.AreEqual(expected, myList[4]);
        }
        public void Remove_RemovingAnObjectAndSeeingIfItemsGetMovedUp_RemoveAnObjectAtSpecifiedIndexThenTheRestOfTheIndexShiftsUp()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;
            int value4 = 4;

            int expected = 3;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);

            myList.Remove(value2);

            //Assert
            Assert.AreEqual(expected, myList[1]);
        }
        public void Remove_RemoveAnObjectNotInArray_TryingToRemoveAnObjectThatDoesntExistShouldThrowException()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int value1 = 1;

            //Act
            myList.Add(value1);

            myList.Remove(myList[2]);

            //Assert
        }
        public void ToStringOverride_CreateAListOfIntsAndGetAString_TakesAListAndOutputsAllValuesAsAString()
        {
            //Arrange
            TheCustomList <int> myList = new TheCustomList <int>();
            int    value1   = 1;
            int    value2   = 2;
            int    value3   = 3;
            int    value4   = 4;
            int    value5   = 5;
            string expected = "1 2 3 4 5";
            string actual   = "";

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);

            actual = myList.ToString();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 23
0
        public void PlusOverload_LastIndexChecker_MakingSureTheLastIndexIsTheLastIndexFromTheSecondList()
        {
            //Arrange
            TheCustomList <int> myList  = new TheCustomList <int>();
            TheCustomList <int> myList2 = new TheCustomList <int>();
            int value1 = 1;
            int value2 = 2;
            int value3 = 3;

            int expected = 3;
            int actual;

            //Act
            myList.Add(value1);
            myList.Add(value2);
            myList2.Add(value3);

            TheCustomList <int> result = myList + myList2;

            actual = result[2];

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