public void Remove_CheckIndex_NextIndexReplacesRemovedIndex() { //arrange CustomListClass <int> customList = new CustomListClass <int>(); int value = 1; int value2 = 2; int value3 = 3; int value4 = 4; int value5 = 5; int expected; int actual; // act customList.Add(value); customList.Add(value2); customList.Add(value3); customList.Add(value4); customList.Add(value5); expected = customList[2]; customList.Remove(value2); actual = customList[1]; //assert Assert.AreEqual(expected, actual); }
public void Remove_CheckWholeList_ValueRemoved() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int value = 1; int value2 = 2; int value3 = 3; int value4 = 4; int value5 = 5; bool expected = false; bool actual = false; //act customList.Add(value); customList.Add(value2); customList.Add(value3); customList.Add(value4); customList.Add(value5); customList.Remove(value2); for (int i = 0; i > customList.Count; i++) { if (value2 == customList[i]) { actual = true; break; } } //assert Assert.AreEqual(expected, actual); }
public void Remove_RemoveFromEmptyList_ItemGoesToIndexZero() { // Arrange CustomListClass <int> testList = new CustomListClass <int>(); int expected = 1; int actual; // act testList.Add(1); testList.Add(2); testList.Remove(2); actual = testList[0]; Assert.AreEqual(expected, actual); }
public void RemoveFromList() { //Arrange CustomListClass <int> list = new CustomListClass <int>() { 4, 3 }; int expectedLength = 1; //Act list.Remove(3); //Assert Assert.AreEqual(expectedLength, list.Count); }
public void Remove_OneItemFromList_CountGoesDownToOne() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 1; int actual; // act customList.Add(1); customList.Add(2); customList.Remove(1); actual = customList.Count; // assert Assert.AreEqual(expected, actual); }
public void Remove_ItemFromMiddleOfList_LastIndicieGoesToZero() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 0; int actual; // act customList.Add(1); customList.Add(2); customList.Add(3); customList.Remove(1); actual = customList[2]; // assert Assert.AreEqual(expected, actual); }
public void Remove_ItemNotInList_ListStaysTheSame() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 3; int actual; // act customList.Add(1); customList.Add(2); customList.Add(3); customList.Remove(4); actual = customList.Count; // assert Assert.AreEqual(expected, actual); }
public void Remove_FirstInstanceOfItemFromList_CountGoesDownToTwo() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 2; int actual; // act customList.Add(1); customList.Add(2); customList.Add(2); customList.Remove(2); actual = customList.Count; // assert Assert.AreEqual(expected, actual); }
public void RemoveSpecificSingleVariable_CheckIndexNumbers_IndexOfExistingVariablesUpdatedAfterRemove() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; int value3 = 32; int value4 = 64; int value5 = 128; myList.Add(value); myList.Add(value2); myList.Add(value3); myList.Add(value4); myList.Add(value5); myList.Remove(value3); Assert.AreEqual(value4, myList[2]); }
public void RemoveSpecificSingleVariableUnsuccessfully_CheckItemValue_ExistingVariablesUnChangedAfterFailedRemoval() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; int value3 = 32; int value4 = 64; int value5 = 128; myList.Add(value); myList.Add(value2); myList.Add(value3); myList.Add(value4); myList.Add(value5); myList.Remove(100); Assert.AreEqual(value5, myList[4]); }
public void Remove_ItemFromList_ArraySizeStaysSame() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 8; int actual; // act customList.Add(1); customList.Add(2); customList.Add(2); customList.Add(1); customList.Add(2); customList.Remove(2); actual = customList.Capacity; // assert Assert.AreEqual(expected, actual); }
public void Remove_ValueNotInList_ListCountRemainsUnchanged() { // Arrange CustomListClass <int> i = new CustomListClass <int>(); i.Add(0); i.Add(1); i.Add(2); i.Add(3); i.Add(4); int expected = 5; // Act i.Remove(5); // Assert int actual = i.Count; Assert.AreEqual(expected, actual); }
public void Remove_ValueInList_ValueIsRemoved() { // Arrange CustomListClass <int> i = new CustomListClass <int>(); i.Add(0); i.Add(1); i.Add(2); i.Add(3); i.Add(4); // Act i.Remove(2); // Assert int expected = 3; int actual = i[2]; Assert.AreEqual(expected, actual); }
public void RemoveSpecificSingleVariable_CheckCountOfArray_ArrayCountUpdatedAfterRemove() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; int value3 = 32; int value4 = 64; int value5 = 128; int value6 = 8; int value7 = 16; int value8 = 32; int value9 = 64; int value10 = 128; int value11 = 8; int value12 = 16; int value13 = 32; int value14 = 64; int value15 = 128; myList.Add(value); myList.Add(value2); myList.Add(value3); myList.Add(value4); myList.Add(value5); myList.Add(value6); myList.Add(value7); myList.Add(value8); myList.Add(value9); myList.Add(value10); myList.Add(value11); myList.Add(value12); myList.Add(value13); myList.Add(value14); myList.Add(value15); myList.Remove(value15); Assert.AreEqual(14, myList.count); }
public void RemoveSpecificSingleVariableUnsuccessfully_CheckCountOfArray_ArrayCountNotChangedByFailedRemoval() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; int value3 = 32; int value4 = 64; int value5 = 128; int value6 = 8; int value7 = 16; int value8 = 32; int value9 = 64; int value10 = 128; int value11 = 8; int value12 = 16; int value13 = 32; int value14 = 64; int value15 = 128; myList.Add(value); myList.Add(value2); myList.Add(value3); myList.Add(value4); myList.Add(value5); myList.Add(value6); myList.Add(value7); myList.Add(value8); myList.Add(value9); myList.Add(value10); myList.Add(value11); myList.Add(value12); myList.Add(value13); myList.Add(value14); myList.Add(value15); myList.Remove(55); Assert.AreEqual(15, myList.count); }
public void Remove_CheckCount_CountDecreasesWhenIndexRemoved() { //arrange CustomListClass <int> customList = new CustomListClass <int>(); int value = 1; int value2 = 2; int value3 = 3; int value4 = 4; int value5 = 5; //act customList.Add(value); customList.Add(value2); customList.Add(value3); customList.Add(value4); customList.Add(value5); int initialCount = 4; customList.Remove(customList[0]); int finalCount = customList.Count; //assert Assert.AreEqual(initialCount, finalCount); }