public void Count_CountsTheVariablesInArray_GivesCorrectNumberAfterRemoving() { //Arrange CustomList <int> shawnList = new CustomList <int>(); int value = 26; int expected; int actual; //Act shawnList.Add(value); shawnList.Remove(shawnList[0]); actual = shawnList.Count; expected = 0; //Assert Assert.AreEqual(expected, actual); }
public void Count_CheckigTheAmountOfVariablesInArray_CheckingCountInStringArray() { //arrange CustomList <string> shawnList = new CustomList <string>(); string words; int actual; int expected; //act words = "Hello"; shawnList.Add(words); actual = shawnList.Count; expected = 1; //assert Assert.AreEqual(expected, actual); }
public void Remove_Int3_RemovesFirstInstance() { CustomList <int> list = new CustomList <int>(); int expectedResult = 3; int actualResult; list.Add(1); list.Add(2); list.Add(3); list.Add(4); list.Add(5); list.Add(3); list.Add(4); list.Remove(3); actualResult = list[4]; Assert.AreEqual(expectedResult, actualResult); }
public void Add_AddingItemToArrayList_DoesIntGetAdded() { //Arrange CustomList <int> shawnList = new CustomList <int>(); int value = 26; int expected; int actual; //Act shawnList.Add(value); actual = shawnList[0]; expected = 26; //Assert Assert.AreEqual(expected, actual); }
public void Add_Item_CountIncreases_ByOne() { //Arange CustomList <int> collectionOfNumbers = new CustomList <int>(); int number = 9; int expected = 1; int actual; //Act collectionOfNumbers.Add(number); actual = collectionOfNumbers.Count; //Assert Assert.AreEqual(expected, actual); }
public void Get_LargeList_ReturnPositiveInteger() { //Arrange CustomList <int> customList = new CustomList <int>() { }; int testInteger = 1; int itemsToAdd = 1000; //Act for (int i = 0; i < itemsToAdd; i++) { customList.Add(testInteger); } int listCount = customList.Count; //Assert Assert.AreEqual(1000, listCount); }
public void Zip_ZippedList_Capacity() { CustomList <int> zippedList = new CustomList <int>(); CustomList <int> list1 = new CustomList <int>(); CustomList <int> list2 = new CustomList <int>(); CustomList <int> expectedList = new CustomList <int>() { 0, 0, 1, 1, 2, 2 }; for (int i = 0; i < 3; i++) { list1.Add(i); list2.Add(i); } zippedList = CustomList <int> .ZipLists(list1, list2); Assert.AreEqual(expectedList.Capacity, zippedList.Capacity); }
public void Zip_ZipTwoListsOfOneTogether_ZippedListOrderedOneThenTwo() { //Arrange CustomList <int> testOne = new CustomList <int>(); CustomList <int> testTwo = new CustomList <int>(); CustomList <int> Zipped; int expected = 2; int actual; //Act testOne.Add(1); testTwo.Add(2); Zipped = CustomList <int> .ZipListTogether(testOne, testTwo); actual = Zipped[1]; //Assert Assert.AreEqual(expected, actual); }
public void Remove_RemovesDesiredElement() { // arrange CustomList <int> testList = new CustomList <int>(); int expected = 3; // act testList.Add(1); testList.Add(2); testList.Add(3); testList.Add(4); testList.Add(5); testList.Add(6); testList.Add(7); testList.Add(8); testList.Remove(2); int actual = testList[1]; // assert Assert.AreEqual(expected, actual); }
public void Zip_ListsOfSingleValueTogether_CountIsTwo() { //Arrange CustomList <int> testOne = new CustomList <int>(); CustomList <int> testTwo = new CustomList <int>(); CustomList <int> Zipped; int expected = 2; int actual; //Act testOne.Add(1); testTwo.Add(2); Zipped = CustomList <int> .ZipListTogether(testOne, testTwo); actual = Zipped.Count; //Assert Assert.AreEqual(expected, actual); }
public void Zip_List_Works_With_Different_Sized_Lists() { //Arrange CustomList <string> a = new CustomList <string>(); CustomList <string> b = new CustomList <string>(); a.Add("one"); b.Add("three"); b.Add("four"); string expected = "[ one, three, four ]"; string actual; //Act actual = a.Zip(b).ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Add_AddingStringItemsToArrayList_CheckingToSeeIfStringWasAdded() { //Arrange CustomList <string> shawnList = new CustomList <string>(); string words = "Hello"; string actual; string expected; //act shawnList.Add(words); expected = "Hello"; actual = shawnList[0]; //assert Assert.AreEqual(expected, actual); }
public void ToString_ConvertBiggerListToString_StringHasCorrectValues() { //Arrange CustomList <int> testList = new CustomList <int>(); testList.Add(111); testList.Add(222); testList.Add(333); testList.Add(444); testList.Add(555); testList.Add(666); testList.Add(777); testList.Add(888); string expected = "111, 222, 333, 444, 555, 666, 777, 888"; string actual; //Act actual = testList.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Zip_ZipListOfEvenAndListOfOddTogether_TheAtIndexOneIsTwo() { //Arrange CustomList <int> testOne = new CustomList <int>(); CustomList <int> testTwo = new CustomList <int>(); CustomList <int> Zipped; int expected = 2; int actual; //Act testOne.Add(1); testOne.Add(3); testTwo.Add(2); Zipped = CustomList <int> .ZipListTogether(testOne, testTwo); actual = Zipped[1]; //Assert Assert.AreEqual(expected, actual); }
public void WereAllTheVariablesOfTheFirstListCaptured() { //Arrange CustomList <int> listOne = new CustomList <int>(); listOne.Add(6); listOne.Add(8); listOne.Add(12); listOne.Add(32); CustomList <int> listTwo = new CustomList <int>(); listTwo.Add(3); listTwo.Add(4); listTwo.Add(57); CustomList <int> result = listOne + listTwo; result.Add(6); result.Add(8); result.Add(12); result.Add(32); result.Add(3); result.Add(4); result.Add(57); //Act int expected = result[3]; int value = listOne[3]; //{ // if (expected[3] == 32) // { // areAllListOneItemsThere = true; // } //} //return true; //Assert Assert.AreEqual(expected, value); }
public void Add_ToAnEmptyList_ItemGoesToIndexZero() { //arrange //to add an object CustomList <int> testList = new CustomList <int>(); int expected = 1; int actual; //act // the variavbles im testing testList.Add(1); actual = testList[0]; //assert // what the results are Assert.AreEqual(expected, actual); }
public void Zip_ZipWhenListOneHasHigherCount_IndexThreeIsFive() { //Arrange CustomList <int> testOne = new CustomList <int>(); CustomList <int> testTwo = new CustomList <int>(); CustomList <int> Zipped; int expected = 5; int actual; //Act testOne.Add(1); testOne.Add(3); testOne.Add(5); testTwo.Add(2); Zipped = CustomList <int> .ZipListTogether(testOne, testTwo); actual = Zipped[3]; //Assert Assert.AreEqual(expected, actual); }
public void ToStringMethod_MethodIsCalled_ListElementsAreConcatenated() { //arrange string expected = "abcd ef"; string actual; CustomList <string> list = new CustomList <string>(); list.Add("a"); list.Add("b"); list.Add("c"); list.Add("d"); list.Add(" "); list.Add("e"); list.Add("f"); //act actual = list.ToString(); //assert Assert.AreEqual(expected, actual); }
public void Adding_More_Than_Capacity_Expect_Expansion_And_Values_Retained() { //Arrange CustomList <int> list = new CustomList <int>(); int sixthValue = 486; //Act list.Add(2); list.Add(6); list.Add(18); list.Add(54); list.Add(162); list.Add(486); //Assert Assert.AreEqual(sixthValue, list[5]); }
public void Minus_Operator_New_List_Deletes_Only_One_Instance_Per_Occurence() { //Arrange CustomList <int> one = new CustomList <int>(); CustomList <int> two = new CustomList <int>(); CustomList <int> result = new CustomList <int>(); one.Add(1); one.Add(1); one.Add(3); two.Add(1); string expected = "[ 1, 3 ]"; string actual; //Act result = one - two; actual = result.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Minus_Operator_Works_With_Strings() { //Arrange CustomList <string> one = new CustomList <string>(); CustomList <string> two = new CustomList <string>(); CustomList <string> result = new CustomList <string>(); one.Add("one"); one.Add("two"); one.Add("three"); two.Add("one"); string expected = "[ two, three ]"; string actual; //Act result = one - two; actual = result.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Remove_RemoveRepeatedValue() { // arrange CustomList <int> testList = new CustomList <int>(); int expected = 5; // act testList.Add(1); testList.Add(1); testList.Add(1); testList.Add(2); testList.Add(2); testList.Add(2); testList.Remove(1); int actual = testList.Count; // assert Assert.AreEqual(expected, actual); }
public void PlusOverLoadOperator_OverLoadOperator_DoesMethodMergeProperlyZeroItemsInOneArray() { //Arrange CustomList <int> List = new CustomList <int>(); CustomList <int> List2 = new CustomList <int>(); string expected; string actual; //Act List.Add(5); List.Add(7); List.Add(9); List.Add(10); List.Add(11); List.Add(6); List.Add(8); CustomList <int> List3 = List + List2; expected = "5, 7, 9, 10, 11, 6, 8"; actual = List3.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void ToString_ConvertingDesiredValueToString_CheckingIfLargeValueListReturnedIsAString() { //arrange CustomList <int> shawnList = new CustomList <int>(); string actual; string expected; //act shawnList.Add(5); shawnList.Add(6); shawnList.Add(7); shawnList.Add(8); shawnList.Add(9); shawnList.Add(10); shawnList.ToString(); actual = shawnList.ToString(); expected = "5, 6, 7, 8, 9, 10"; //assert Assert.AreEqual(expected, actual); }
public void DidResultOfListMergeTheTwoLists() { //Arrange CustomList <int> listOne = new CustomList <int>(); listOne.Add(6); listOne.Add(8); listOne.Add(12); listOne.Add(32); CustomList <int> listTwo = new CustomList <int>(); listTwo.Add(3); listTwo.Add(4); listTwo.Add(57); CustomList <int> expected = new CustomList <int>(); expected.Add(6); expected.Add(8); expected.Add(12); expected.Add(32); expected.Add(3); expected.Add(4); expected.Add(57); CustomList <int> result; //Act result = listOne + listTwo; //Assert Assert.AreEqual(expected.ToString(), result.ToString()); }
public void Value_Not_Contained_In_List_When_Removed() { //Arrange CustomList <int> list = new CustomList <int>(); int valueToRemove = 54; list.Add(2); list.Add(6); list.Add(18); list.Add(54); list.Add(162); list.Add(486); bool expectedResult = false; //Act list.Remove(valueToRemove); bool actualResult = list.Contains(valueToRemove); Assert.AreEqual(expectedResult, actualResult); }
public void ToString_ConvertingDesiredValueToString_CheckingIfLargeValueReturnedIsAStringAfterRemoving() { //arrange CustomList <int> shawnList = new CustomList <int>(); string actual; string expected; //act shawnList.Add(5); shawnList.Add(5); shawnList.Add(5); shawnList.Add(5); shawnList.Add(5); shawnList.Add(5); shawnList.Remove(5); shawnList.ToString(); actual = shawnList.ToString(); expected = "5, 5, 5, 5, 5"; //assert Assert.AreEqual(expected, actual); }
public void Remove_And_Count_Is_One_Shorter_Than_Before() { //Arrange CustomList <int> list = new CustomList <int>(); int valueToRemove = 54; list.Add(2); list.Add(6); list.Add(18); list.Add(54); list.Add(162); list.Add(486); int expectedCount = 5; //Act list.Remove(valueToRemove); int actualCount = list.Count; //Assert Assert.AreEqual(expectedCount, actualCount); }
public void Add_SixValues_IncrementCount() { //Arrange CustomList <int> myList = new CustomList <int>(); int expected = 6; int firstValue = 7; int secondValue = 11; int thirdValue = 24; int fourthValue = 32; int fifthValue = 44; int sixthValue = 59; //Act myList.Add(firstValue); myList.Add(secondValue); myList.Add(thirdValue); myList.Add(fourthValue); myList.Add(fifthValue); myList.Add(sixthValue); //Assert Assert.AreEqual(expected, myList.Count); }
public void Remove_RemoveItemFromListOfMultipleItems_CapacityRemainsTheSameForFutureItemsToAdd() { //arrange CustomList <float> testList = new CustomList <float>(); float expected = 6; float actual; testList.Add(22); testList.Add(12); testList.Add(23); testList.Add(19); testList.Add(28); testList.Add(29); //act testList.List.Remove(22); actual = testList.Capacity; //assert Assert.AreEqual(expected, actual); }