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 Add_CheckCapacity_CapacityIncreasesWhenLessThanCountMinus1() // should be descriptive of test { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int value = 1; int value2 = 2; int value3 = 3; int value4 = 4; int value5 = 5; int value6 = 6; int expected = value6; // act call method customList.Add(value); customList.Add(value2); customList.Add(value3); customList.Add(value4); customList.Add(value5); customList.Add(value6); int count = customList.Count; int actual = customList[5]; // assert Assert.AreEqual(expected, actual); }
public void MinusOverload_CheckWholeList_ListRemoved() { //arrange CustomListClass <int> customList1 = new CustomListClass <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; CustomListClass <int> customList2 = new CustomListClass <int>() { 5, 6, 7, 8 }; bool expected = false; bool actual = false; //act CustomListClass <int> customList3 = customList1 - customList2; for (int i = 0; i > customList2.Count; i++) { for (int j = 0; j > customList1.Count; j++) { if (customList2[i] == customList1[j]) { actual = true; break; } } } //assert Assert.AreEqual(expected, actual); }
public void OverloadNegationOperator_CheckCombinedLists_NewListRemovesElementsFromFirstList() { 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); CustomListClass <int> myList2 = new CustomListClass <int>(); int num = 7; int num2 = 15; int num3 = 32; int num4 = 65; int num5 = 127; myList2.Add(num); myList2.Add(num2); myList2.Add(num3); myList2.Add(num4); myList2.Add(num5); CustomListClass <int> removedList = new CustomListClass <int>(); removedList = myList - myList2; Assert.AreEqual(value5, removedList[3]); }
public void OverloadAddOperator_CheckCombinedLists_NewListHasElementsFromSecondList() { 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); CustomListClass <int> myList2 = new CustomListClass <int>(); int num = 8; int num2 = 16; int num3 = 32; int num4 = 64; int num5 = 128; myList2.Add(num); myList2.Add(num2); myList2.Add(num3); myList2.Add(num4); myList2.Add(num5); CustomListClass <int> combinedList = new CustomListClass <int>(); combinedList = myList + myList2; Assert.AreEqual(num5, combinedList[9]); }
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 AddSingleVariableIndex_CheckIndex0_OneIntPlacedAtIndex0() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; myList.Add(value); Assert.AreEqual(value, myList[0]); }
public void CustomListTest() { var expected = new CustomListClass { "hello" }; var actual = Roundtrip(expected); CollectionAssert.AreEqual(expected, actual); }
public void AddTwoVariablesIndex_CheckIndex0And1_EachIntPlacedAtProperIndex() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; myList.Add(value); myList.Add(value2); Assert.AreEqual(value2, myList[1]); }
public void AddToList() { //Arrange CustomListClass <int> list = new CustomListClass <int>(); int expectedLength = 1; //Act list.Add(6); //Assert Assert.AreEqual(expectedLength, list.Count); }
public void AddThreeVariablesIndex_CheckIndex0And1And2_EachIntPlacedAtProperIndex() { CustomListClass <int> myList = new CustomListClass <int>(); int value = 8; int value2 = 16; int value3 = 32; myList.Add(value); myList.Add(value2); myList.Add(value3); Assert.AreEqual(value3, myList[2]); }
public void ToString_NoItemsInList_EmptyString() { // Arrange string expected = " "; CustomListClass <int> d = new CustomListClass <int>(); // Act string actual = d.ToString(); // Assert Assert.AreEqual(expected, actual); }
public void Add_AddToEmptyList_ItemGoesToIndexZero() { // Arrange CustomListClass <int> testList = new CustomListClass <int>(); int expected = 1; int actual; // act testList.Add(expected); actual = testList[0]; Assert.AreEqual(expected, actual); }
public Program() { CustomListClass <int> testList = new CustomListClass <int>(); int expected = 4; int actual; // act testList.Add(1); testList.Add(2); testList.Add(3); testList.Add(4); testList.Add(5); actual = testList.Count; }
public void Add_CheckCount_CountIncreases() // should be descriptive of test { //arrange CustomListClass <string> customList = new CustomListClass <string>(); string value = "string"; int expectedCount = 1; // act call method customList.Add(value); int actualCount = customList.Count; //assert Assert.AreEqual(expectedCount, actualCount); }
public void Add_AddToEmptyList_CountGoesToOne() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 1; int actual; // act customList.Add(198765); actual = customList.Count; // assert 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 Add_AddToListWithExistingItem_NewItemGoesToEndOfList() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 2; int actual; // act customList.Add(1); customList.Add(2); actual = customList[1]; // assert Assert.AreEqual(expected, actual); }
public void Add_AddToListWithExistingItem_CounterGoesUpOne() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 2; int actual; // act customList.Add(1); customList.Add(2); actual = customList.Count; // 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 Add_CheckSpecificIndex_ValueExists() // should be descriptive of test { //arrange CustomListClass <string> customList = new CustomListClass <string>(); string input = "string"; string expected = "string"; // act call method customList.Add(input); string actual = customList[0]; //assert Assert.AreEqual(expected, actual); }
public void IterateList() { //Arrange CustomListClass <string> list = new CustomListClass <string>() { "Friday", "Saturday", "Sunday" }; int target = 3; string result; //Act result = IEnumerator list.GetEnumerator(); //Assert Assert.AreEqual(target, result); }
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 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 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 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 ChangeValuesToString_CheckStringDesignation_LongListAlteredToString() { 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.ToString(); Assert.AreEqual("8163264128", myList.ToString()); }
// UnitOfWork--Method_StateUnderTest_ExpectedResult // write a test for when the array size changes (what is you array's starting size?) public void Add_AddToListAtMaxCapacity_ArraySizeDoubles() { // arrange CustomListClass <int> customList = new CustomListClass <int>(); int expected = 5; int actual; // act customList.Add(1); customList.Add(2); customList.Add(3); customList.Add(4); customList.Add(5); actual = customList.Count; // assert Assert.AreEqual(expected, actual); }