本文整理汇总了C#中DynamicList.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicList.RemoveAt方法的具体用法?C# DynamicList.RemoveAt怎么用?C# DynamicList.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicList
的用法示例。
在下文中一共展示了DynamicList.RemoveAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRemoveAtMethod_WithNegativeIndex_ShouldThrow
public void TestRemoveAtMethod_WithNegativeIndex_ShouldThrow()
{
DynamicList<int> arr = new DynamicList<int>();
arr.Add(1);
arr.RemoveAt(-1);
}
示例2: TestRemoveAt_ValidIndex_ShouldReturnProperElement
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);
}
示例3: TestRemoveAtMethod_SingleElement_ElementsAreEqual
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.");
}
示例4: RemoveShouldThrowExceptionIfIndexIsNotPresent
public void RemoveShouldThrowExceptionIfIndexIsNotPresent()
{
DynamicList<int> list = new DynamicList<int>();
list.Add(2);
list.Add(3);
list.Add(4);
list.RemoveAt(4);
}
示例5: RemovingElementAtIndexShouldReturnElement
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.");
}
示例6: TestRemoveAtForExceptionWhenCountIsZeroOrNegative
public void TestRemoveAtForExceptionWhenCountIsZeroOrNegative()
{
var dynamicList = new DynamicList<int>();
var elementForRemove = 1;
// Act
dynamicList.RemoveAt(elementForRemove);
}
示例7: TestRemoveAtMethod_SingleElement_TheCountHasChanged
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.");
}
示例8: RemoveAt_ShouldThrowAnException_WhenTheIndex_IsOutOfRange
public void RemoveAt_ShouldThrowAnException_WhenTheIndex_IsOutOfRange()
{
var dynamicList = new DynamicList<string>();
dynamicList.Add("Kori");
dynamicList.Add("Moti4kata");
dynamicList.Add("allahuakbar");
dynamicList.RemoveAt(4);
}
示例9: RemovingElementAtOutOfRangePositionFromNoneEmptyDynamicListOfIntsShouldThrowException
public void RemovingElementAtOutOfRangePositionFromNoneEmptyDynamicListOfIntsShouldThrowException()
{
var dynamicListOfInts = new DynamicList<int>();
dynamicListOfInts.Add(1);
dynamicListOfInts.Add(2);
dynamicListOfInts.Add(3);
dynamicListOfInts.RemoveAt(4);
}
示例10: RemovingElementAtIndexShouldRemoveElementFromListAndReorderList
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.");
}
示例11: TestRemoveElements_AtGivenIndex
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.");
}
示例12: RemoveAt_ShouldReturnTheRemovenElement
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");
}
示例13: TestList_RemoveAt_GivenIndex
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.");
}
示例14: RemoveAt_ShouldRemoveAnElementAt_GivenPosition_AndTheCount_ShouldBeReduced_By_One
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);
}
示例15: TestRemoveAt
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.");
}