当前位置: 首页>>代码示例>>C#>>正文


C# DynamicList.RemoveAt方法代码示例

本文整理汇总了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);
        }
开发者ID:ZahariyaPehlivanova,项目名称:KPK-Unit-Testing-Homework,代码行数:7,代码来源:CustomLinkedListTests.cs

示例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);
 }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:8,代码来源:TestDynamicListRemoveAt.cs

示例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.");
        }
开发者ID:k1r1L,项目名称:Soft-Uni-Homeworks,代码行数:8,代码来源:DynamicListTest.cs

示例4: RemoveShouldThrowExceptionIfIndexIsNotPresent

 public void RemoveShouldThrowExceptionIfIndexIsNotPresent()
 {
     DynamicList<int> list = new DynamicList<int>();
     list.Add(2);
     list.Add(3);
     list.Add(4);
     list.RemoveAt(4);
 }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:8,代码来源:UnitTest1.cs

示例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.");
        }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:8,代码来源:DynamicListsTests.cs

示例6: TestRemoveAtForExceptionWhenCountIsZeroOrNegative

        public void TestRemoveAtForExceptionWhenCountIsZeroOrNegative()
        {
            var dynamicList = new DynamicList<int>();
            var elementForRemove = 1;

            // Act
            dynamicList.RemoveAt(elementForRemove);
        }
开发者ID:ivayloivanof,项目名称:HQC,代码行数:8,代码来源:DynamicListTest.cs

示例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.");
        }
开发者ID:k1r1L,项目名称:Soft-Uni-Homeworks,代码行数:9,代码来源:DynamicListTest.cs

示例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);
        }
开发者ID:broxigarthered,项目名称:HQC-Homeworks-Softuni,代码行数:9,代码来源:CustomLinkedListTests.cs

示例9: RemovingElementAtOutOfRangePositionFromNoneEmptyDynamicListOfIntsShouldThrowException

        public void RemovingElementAtOutOfRangePositionFromNoneEmptyDynamicListOfIntsShouldThrowException()
        {
            var dynamicListOfInts = new DynamicList<int>();
            dynamicListOfInts.Add(1);
            dynamicListOfInts.Add(2);
            dynamicListOfInts.Add(3);

            dynamicListOfInts.RemoveAt(4);
        }
开发者ID:borko9696,项目名称:SoftwareUniversity,代码行数:9,代码来源:UnitTest.cs

示例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.");
 }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:10,代码来源:DynamicListsTests.cs

示例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.");
        }
开发者ID:IlianStefanov,项目名称:SoftUni,代码行数:11,代码来源:DynamicListTests.cs

示例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");
        }
开发者ID:broxigarthered,项目名称:HQC-Homeworks-Softuni,代码行数:12,代码来源:CustomLinkedListTests.cs

示例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.");
 }
开发者ID:emilrr,项目名称:SoftUni-Fundamental-Level,代码行数:12,代码来源:CustomLinkedListTests.cs

示例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);
        }
开发者ID:broxigarthered,项目名称:HQC-Homeworks-Softuni,代码行数:13,代码来源:CustomLinkedListTests.cs

示例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.");
        }
开发者ID:ivayloivanof,项目名称:HQC,代码行数:15,代码来源:DynamicListTest.cs


注:本文中的DynamicList.RemoveAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。