public void TestRemoveAtMethod_WithNegativeIndex_ShouldThrow() { DynamicList<int> arr = new DynamicList<int>(); arr.Add(1); arr.RemoveAt(-1); }
public void RemovingElementAtIndexShouldReturnElement() { var numList = new DynamicList<int>(); numList.Add(7); int number = numList.RemoveAt(0); Assert.AreEqual(7, number, "The elements is found and it's equal to what is expected."); }
public void TestRemoveAt_ValidIndex_ShouldReturnProperElement() { var list = new DynamicList<int>(); list.Add(5); list.Add(15); var element = list.RemoveAt(1); Assert.AreEqual(15, element); }
public void TestRemoveAtMethod_SingleElement_ElementsAreEqual() { DynamicList<int> customList = new DynamicList<int>(); customList.Add(500); int element = customList.RemoveAt(0); Assert.AreEqual(500, element, "Returning the removed element failed: The removed element should be 500."); }
public void RemoveShouldThrowExceptionIfIndexIsNotPresent() { DynamicList<int> list = new DynamicList<int>(); list.Add(2); list.Add(3); list.Add(4); list.RemoveAt(4); }
public void TestRemoveAtForExceptionWhenCountIsZeroOrNegative() { var dynamicList = new DynamicList<int>(); var elementForRemove = 1; // Act dynamicList.RemoveAt(elementForRemove); }
public void RemovingElementAtOutOfRangePositionFromNoneEmptyDynamicListOfIntsShouldThrowException() { var dynamicListOfInts = new DynamicList<int>(); dynamicListOfInts.Add(1); dynamicListOfInts.Add(2); dynamicListOfInts.Add(3); dynamicListOfInts.RemoveAt(4); }
public void RemoveAt_ShouldThrowAnException_WhenTheIndex_IsOutOfRange() { var dynamicList = new DynamicList<string>(); dynamicList.Add("Kori"); dynamicList.Add("Moti4kata"); dynamicList.Add("allahuakbar"); dynamicList.RemoveAt(4); }
public void TestRemoveAtMethod_SingleElement_TheCountHasChanged() { DynamicList<int> customList = new DynamicList<int>(); customList.Add(500); customList.RemoveAt(0); int count = customList.Count; Assert.AreEqual(0, count, "Removing failed: The count should be zero."); }
public void RemovingElementAtIndexShouldRemoveElementFromListAndReorderList() { var numList = new DynamicList<int>(); numList.Add(13); numList.Add(-6); numList.Add(5); int number = numList.RemoveAt(0); Assert.AreEqual(-6, numList[0], "Does not reorder the elements."); }
public void TestRemovingElementInListInNonExistingIndex(int index) { DynamicList <int> customList = new DynamicList <int>(); customList.Add(5); customList.Add(5); customList.Add(5); customList.Add(13); Assert.Catch <ArgumentOutOfRangeException>(() => customList.RemoveAt(index)); }
public void TestListCountAfterRemoveAt() { DynamicList <int> list = new DynamicList <int>(); list.Add(0); list.RemoveAt(0); int count = list.Count; Assert.AreEqual(0, count); }
public void TestRemoveElements_AtGivenIndex() { var dynamicList = new DynamicList<int>(); dynamicList.Add(10); dynamicList.Add(66); dynamicList.Add(69); dynamicList.Add(42); dynamicList.RemoveAt(2); Assert.AreEqual(3, dynamicList.Count, "Returns wrong element after removal."); }
public void RemoveAtTest() { for (var i = 0; i < 4; i++) { _list.Add(i); } _list.RemoveAt(2); Assert.That(_list.Count, Is.EqualTo(3)); Assert.That(_list.Items, Is.EqualTo(new int[] { 0, 1, 3 })); }
public void TestRemovingElementAtIndexByCount() { dynamicList.Add(10); dynamicList.Add(5); dynamicList.Add(3); dynamicList.RemoveAt(2); Assert.AreEqual(2, dynamicList.Count); }
public void TestRemovingElementInList() { DynamicList <int> customList = new DynamicList <int>(); customList.Add(5); customList.Add(5); customList.Add(5); customList.Add(13); customList.RemoveAt(2); Assert.That(customList[2], Is.EqualTo(13)); }
public void TestRemovingElementInListAndReturnsCorrectValue() { DynamicList <int> customList = new DynamicList <int>(); customList.Add(5); customList.Add(5); customList.Add(5); customList.Add(13); int result = customList.RemoveAt(2); Assert.That(result, Is.EqualTo(5)); }
public void RemoveAtMethod_ShouldThrowExceptionIfIndexIsInvalid(int[] valuesToAdd, int index) { DynamicList <int> testList = new DynamicList <int>(); for (int i = 0; i < valuesToAdd.Length; i++) { testList.Add(valuesToAdd[i]); } Assert.That(() => testList.RemoveAt(index), Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void RemovingElementAtIndexShouldRemoveElementOfList() { var numbers = new DynamicList <int>(); numbers.Add(15); numbers.Add(10); var number = numbers.RemoveAt(0); var result = numbers.IndexOf(0); Assert.AreEqual(-1, result, "The elements is founded."); Assert.AreEqual(10, numbers[0], "Do not reorders the elements."); }
public void RemoveAtFunctionShouldThrowsExceptionIfProvidedIndexIsInvalid(int index) { DynamicList <int> list = new DynamicList <int>(); for (int i = 0; i < 100; i++) { list.Add(i); } Assert.Throws <ArgumentOutOfRangeException>(() => list.RemoveAt(index), "Exception " + "should be thrown if provided index is invalid"); }
public void RemoveAt_ShouldReturnTheRemovenElement() { var dynamicList = new DynamicList<string>(); dynamicList.Add("Kori"); dynamicList.Add("Moti4kata"); dynamicList.Add("allahuakbar"); var removedElement = dynamicList.RemoveAt(2); Assert.AreEqual(removedElement, "allahuakbar", "The method .RemoveAt isn't removing the element properly"); }
public void TestList_RemoveAt_GivenIndex() { DynamicList<int> list = new DynamicList<int>(); list.Add(0); list.Add(1); list.Add(2); list.RemoveAt(1); int firstNumber = list[0]; int secondNumber = list[1]; Assert.AreEqual(0, firstNumber, "The first number should be the first entered in the list."); Assert.AreEqual(2, secondNumber, "The second number should be the third entered after removing the second from the list."); }
public void TestRemoveElements_AtGivenIndex() { var dynamicList = new DynamicList <int>(); dynamicList.Add(10); dynamicList.Add(66); dynamicList.Add(69); dynamicList.Add(42); dynamicList.RemoveAt(2); Assert.AreEqual(3, dynamicList.Count, "Returns wrong element after removal."); }
public void RemovAtMethodShouldRemoveElementFromTheCollection(int index) { DynamicList <int> coolList = new DynamicList <int>(); coolList.Add(6); coolList.Add(8); var collectionCount = coolList.Count; coolList.RemoveAt(index); Assert.That(coolList.Count, Is.EqualTo(collectionCount - 1)); }
public void RemoveAt_ShouldRemoveAnElementAt_GivenPosition_AndTheCount_ShouldBeReduced_By_One() { var dynamicList = new DynamicList<string>(); var expectedLength = 2; dynamicList.Add("Kori"); dynamicList.Add("Moti4kata"); dynamicList.Add("allahuakbar"); dynamicList.RemoveAt(2); Assert.AreEqual(expectedLength, dynamicList.Count, "The method .RemoveAt isn't decrementing the list length correctly. The dynamicList count is {0}", dynamicList.Count); }
public void Test_DynamicListRemoveAt_ShouldRemoveAtGivenIndex() { DynamicList <int> testList = new DynamicList <int>(); int count = 15; for (int number = 0; number < count; number++) { testList.Add(number * 10); } int actualIndext = testList.RemoveAt(5); Assert.AreEqual(50, actualIndext, "Removed index is not the same number!"); }
public void RemovAtMethodShouldReturnRemovedElementFromTheCollection(int index) { DynamicList <int> coolList = new DynamicList <int>(); coolList.Add(6); coolList.Add(8); var element = coolList[index]; var removedElement = coolList.RemoveAt(index); Assert.That(element, Is.EqualTo(removedElement)); }
public void TestRemoveAtFromNoEmptyList_ShouldRemoveElementAndReturnHisValue() { // Arrange var list = new DynamicList <string>(); list.Add("te"); list.Add("tes"); list.Add("test"); var removedElement = list.RemoveAt(1); // Assert Assert.AreSame("tes", removedElement); Assert.AreEqual(2, list.Count); }
public void RemoveAtMethod(int[] valuesToAdd, int index) { DynamicList <int> testList = new DynamicList <int>(); for (int i = 0; i < valuesToAdd.Length; i++) { testList.Add(valuesToAdd[i]); } var expectedValue = testList[index]; var returnedValue = testList.RemoveAt(index); Assert.That(expectedValue, Is.EqualTo(returnedValue)); }
public void RemoveAtFunctionShouldRemomveElement() { DynamicList <int> list = new DynamicList <int>(); int controlValue = 5; list.Add(controlValue); int returnedElement = list.RemoveAt(0); Assert.That(returnedElement, Is.EqualTo(controlValue), "List should be able to remove element at " + "certain valid index"); Assert.That(list.Count, Is.EqualTo(0), $"List count should be zero, " + $"but it was {list.Count}"); }
public void RemoveAt_TestRemovingElementAtCurrentPosition_ShouldPassTest() { var dynamicList = new DynamicList <int>(); dynamicList.Add(3); dynamicList.Add(5); dynamicList.Add(7); dynamicList.RemoveAt(1); var indexAtPositionOne = dynamicList[1]; Assert.AreEqual(7, indexAtPositionOne, "Element at position one should become 7"); }
public void TestRemoveByIndex() { DynamicList <int> expected = new DynamicList <int>() { 1, 2, 4 }; DynamicList <int> actual = new DynamicList <int>() { 1, 2, 3, 4 }; actual.RemoveAt(2); Assert.IsTrue(expected.Equals(actual)); }
public void RemoveAt_Remove_ShouldDecrementCount() { var list = new DynamicList <int>(); list.Add(5); list.Add(6); list.Add(7); list.RemoveAt(1); var epected = 2; var actual = list.Count; Assert.AreEqual(epected, actual); }
public void TestRemoveAt() { DynamicList <int> list = new DynamicList <int>(); list.Add(0); list.Add(1); list.Add(2); list.RemoveAt(1); int firstNumber = list[0]; int secondNumber = list[1]; Assert.AreEqual(0, firstNumber, "The first number should be the first entered in the list."); Assert.AreEqual(2, secondNumber, "The second number should be the third entered after removing the second from the list."); }
public void RemoveAtShouldThrowException(int index) { DynamicList <int> list = new DynamicList <int>(); int a = 2; int b = 3; int c = 4; list.Add(a); list.Add(b); list.Add(c); Assert.Throws <ArgumentOutOfRangeException>(() => list.RemoveAt(index), "RemoveAt did not throw proper exception"); }
public void RemoveAt_CorrectIndex_ShouldRemoveTheRightItem() { var list = new DynamicList <int>(); list.Add(1); list.Add(2); list.Add(3); var itemToRemove = 2; list.RemoveAt(1); var expected = false; Assert.AreEqual(expected, list.Contains(itemToRemove)); }
public void TestRemoveAt() { var dynamicList = new DynamicList<int>(); var elementForRemove = 1; dynamicList.Add(0); dynamicList.Add(elementForRemove); dynamicList.Add(2); // Act var removedElement = dynamicList.RemoveAt(1); // Assert Assert.AreEqual(elementForRemove, removedElement, "Element for remove not removed."); Assert.AreEqual(2, dynamicList.Count, "Dynamic list not remove element."); }
public void RemoveAtRemovesValueAtIndex() { //Arrange DynamicList <int> customList = new DynamicList <int>(); //Act customList.Add(420); customList.RemoveAt(0); int expectedCount = 0; int actualCount = customList.Count; //Assert Assert.AreEqual(expectedCount, actualCount, "RemoveAt method doesn't remove right value"); }
public void RemoveAtReturnesAndRemovesValueAtIndex() { //Arrange DynamicList <int> customList = new DynamicList <int>(); //Act customList.Add(420); int removedValue = customList.RemoveAt(0); int expectedResult = 420; int actualResult = removedValue; //Assert Assert.AreEqual(expectedResult, actualResult, "RemoveAt method doesn't return right value"); }
public void Remove_TestRemainingElementsPositionAFterRemoveAt_ShouldPassTheTest() { var dynamicList = new DynamicList <string>(); dynamicList.Add("one"); dynamicList.Add("two"); dynamicList.Add("three"); dynamicList.RemoveAt(1); string first = dynamicList[0]; string second = dynamicList[1]; Assert.AreEqual("one", first, "The string entered first should be at position 0."); Assert.AreEqual("three", second, "The entered third should be at position 1 after the removal at 1."); }
public void RemoveAt_TestRemainingElementsPositionsAfterRemoveAt_ShouldPassTest() { DynamicList.Add("one"); DynamicList.Add("two"); DynamicList.Add("three"); this.AddCleanupAction(() => DynamicList.Remove("one")); this.AddCleanupAction(() => DynamicList.Remove("three")); DynamicList.RemoveAt(1); string first = DynamicList[0]; string second = DynamicList[1]; Assert.AreEqual("one", first, "The string entered first should be at position 0."); Assert.AreEqual("three", second, "The entered third should be at position 1 after the removal at 1."); }
public void RemovingElementAtCorrectPositionFromNoneEmptyDynamicListOfIntsShouldReturnCorrectObject() { var dynamicListOfInts = new DynamicList<int>(); dynamicListOfInts.Add(0); dynamicListOfInts.Add(1); dynamicListOfInts.Add(2); int startingCount = dynamicListOfInts.Count; dynamicListOfInts.RemoveAt(1); bool isRemovedAtPositionCorrect = dynamicListOfInts[0] == 0 && dynamicListOfInts[1] == 2 && dynamicListOfInts.Count == startingCount - 1; Assert.AreEqual(true, isRemovedAtPositionCorrect, string.Format("The method \"RemoveAt\" does not work correctly!")); }
public void RemoveAtShouldReturnRemoved() { DynamicList <int> list = new DynamicList <int>(); int a = 2; int b = 3; int c = 4; list.Add(a); list.Add(b); list.Add(c); int removed = list.RemoveAt(1); Assert.That(removed, Is.EqualTo(b), "RemoveAt did not return proper result"); }
public void RemoveAtShouldDecreaseCount() { DynamicList <int> list = new DynamicList <int>(); int a = 2; int b = 3; int c = 4; list.Add(a); list.Add(b); list.Add(c); list.RemoveAt(1); Assert.That(list.Count, Is.EqualTo(2), "RemoveAt did not properly decrease counter"); }
public void TestRemoveAt() { int[] desiredList = new int[] { 34, 56 }; DynamicList <int> list = new DynamicList <int> { 12, 34, 56 }; list.RemoveAt(0); int i = 0; foreach (int item in list) { Assert.AreEqual(item, desiredList[i]); i++; } }
public void TestRemoveAt() { var dynamicList = new DynamicList <int>(); var elementForRemove = 1; dynamicList.Add(0); dynamicList.Add(elementForRemove); dynamicList.Add(2); // Act var removedElement = dynamicList.RemoveAt(1); // Assert Assert.AreEqual(elementForRemove, removedElement, "Element for remove not removed."); Assert.AreEqual(2, dynamicList.Count, "Dynamic list not remove element."); }
public void RemoveAndRemoveAtTest() { DynamicList<int> numbers = new DynamicList<int>(); numbers.Add(5); numbers.Add(7); numbers.Add(9); numbers.Remove(5); Assert.IsFalse(numbers.Contains(5), "Remove method doesn't work correctly."); numbers.RemoveAt(1); Assert.AreEqual(-1, numbers.IndexOf(9), "RemoveAt method doesn't work correctly."); Assert.AreEqual(-1, numbers.Remove(13), "Error when trying to remove unexisting item."); Assert.AreEqual(0, numbers.Remove(7), "Wrong return value of remove method."); }
public void RemoveElementAtIndex_ElementSuccessfullyRemoved() { var dynamicList = new DynamicList<int>(); const int firstElement = 666; const int secondElement = 777; dynamicList.Add(firstElement); dynamicList.Add(secondElement); dynamicList.RemoveAt(0); Assert.AreEqual(1, dynamicList.Count, "The collection's lenght is not 1!"); Assert.AreEqual(secondElement, dynamicList[0], "The collection's element does not equal the element it should be equal to!"); }
public void RemoveAt_InvalidIndex_ShoudThrow() { var list = new DynamicList<int>(); list.Add(5); list.RemoveAt(-1); }
public void TestRemoveAtOnIndexGreaterThanCount() { DynamicList<int> list = new DynamicList<int>(); list.Add(0); list.Add(1); list.RemoveAt(2); }
public void RemovingElementAtIndexShouldRemoveElementOfList() { var numbers = new DynamicList<int>(); numbers.Add(15); numbers.Add(10); var number = numbers.RemoveAt(0); var result = numbers.IndexOf(0); Assert.AreEqual(-1, result, "The elements is founded."); Assert.AreEqual(10, numbers[0], "Do not reorders the elements."); }
public void RemovingElementAtIndexShouldReturnElement() { var numbers = new DynamicList<int>(); numbers.Add(15); var number = numbers.RemoveAt(0); Assert.AreEqual(15, number, "Value is not equal of expected."); }
public void TestRemoveAt_InvalidIndex_ShouldThrow() { var list = new DynamicList<int>(); list.RemoveAt(1); }
public void RemoveElementAtIndex_ReturnElement() { var dynamicList = new DynamicList<int>(); const int firstElement = 666; const int secondElement = 777; dynamicList.Add(firstElement); dynamicList.Add(secondElement); var getElement = dynamicList.RemoveAt(0); Assert.AreEqual(firstElement, getElement, "The returned element is not correct!"); }
public void RemoveAtTest() { DynamicList<int> list = new DynamicList<int>(); list.Add(1); list.Add(2); list.Add(3); list.RemoveAt(0); Assert.AreNotEqual(1, list[0], "List does not remove items "); }
public void RemoveElementAtOutOfRangeIndex_ThrowException() { var dynamicList = new DynamicList<int>(); const int firstElement = 666; const int secondElement = 777; dynamicList.Add(firstElement); dynamicList.Add(secondElement); var getElement = dynamicList.RemoveAt(3); }
public void TestListCountAfterRemoveAt() { DynamicList<int> list = new DynamicList<int>(); list.Add(0); list.RemoveAt(0); int count = list.Count; Assert.AreEqual(0, count); }
public void RemovingElementAtIndexShouldDecreaseCount() { var numbers = new DynamicList<int>(); numbers.Add(15); var number = numbers.RemoveAt(0); Assert.AreEqual(0, numbers.Count, "The count does not decrease."); }
public void TestRemoveAtOnNegativeIndex() { DynamicList<int> list = new DynamicList<int>(); list.RemoveAt(-1); }
public void RemoveAt_Remove_ShouldDecrementCount() { var list = new DynamicList<int>(); list.Add(5); list.Add(6); list.Add(7); list.RemoveAt(1); var epected = 2; var actual = list.Count; Assert.AreEqual(epected, actual); }