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


C# DynamicList.Remove方法代码示例

本文整理汇总了C#中DynamicList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicList.Remove方法的具体用法?C# DynamicList.Remove怎么用?C# DynamicList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicList的用法示例。


在下文中一共展示了DynamicList.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestRemove_NotExistingElement_ShouldNeutralIndex

        public void TestRemove_NotExistingElement_ShouldNeutralIndex()
        {
            var list = new DynamicList<int>();

            var index = list.Remove(1);
            Assert.AreEqual(-1, index);
        }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:7,代码来源:TestDynamicListAddRemoveCount.cs

示例2: TestRemoveMethod_WithNonExistingObject_ShouldReturnNegativeValue

        public void TestRemoveMethod_WithNonExistingObject_ShouldReturnNegativeValue()
        {
            DynamicList<int> arr = new DynamicList<int>();
            arr.Add(1);
            arr.Add(2);

            Assert.AreEqual(-1, arr.Remove(3), "The Remove method shuld not remove non-existing objects!");
        }
开发者ID:ZahariyaPehlivanova,项目名称:KPK-Unit-Testing-Homework,代码行数:8,代码来源:CustomLinkedListTests.cs

示例3: Count_MultipleAddAndRemove_ShouldProperCount

        public void Count_MultipleAddAndRemove_ShouldProperCount()
        {
            var list = new DynamicList<int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(i);
                list.Add(i);
                list.Remove(i);
            }

            var index = list.Remove(9);
            var count = list.Count;

            Assert.AreEqual(9, count);
            Assert.AreEqual(9, index);
        }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:17,代码来源:TestDynamicListAddRemoveCount.cs

示例4: RemoveAndRemoveAtTest

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

示例5: Count_SingleAddAndRemove_ShouldProperCount

 public void Count_SingleAddAndRemove_ShouldProperCount()
 {
     var list = new DynamicList<int>();
     list.Add(5);
     var index = list.Remove(5);
     var count = list.Count;
     Assert.AreEqual(0, count);
     Assert.AreEqual(0, index);
 }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:9,代码来源:TestDynamicListAddRemoveCount.cs

示例6: RemovingNoneExistingElementFromNoneEmptyDynamicListOfIntsShouldReturnMinusOne

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

            var returnedValue = dynamicListOfInts.Remove(9);

            Assert.AreEqual(-1, returnedValue, string.Format("The method \"Remove\" does not work correctly when removing none existing number.\nShould return -1!" + string.Format("returned value is {0}", returnedValue)));
        }
开发者ID:borko9696,项目名称:SoftwareUniversity,代码行数:9,代码来源:UnitTest.cs

示例7: TestRemoveWhenListIsEmptyOrNotFound

        public void TestRemoveWhenListIsEmptyOrNotFound()
        {
            var dynamicList = new DynamicList<int>();

            // Act
            var removedElementIndex = dynamicList.Remove(1);

            // Assert
            Assert.IsTrue(removedElementIndex < 0, "List in not empty or not found");
        }
开发者ID:ivayloivanof,项目名称:HQC,代码行数:10,代码来源:DynamicListTest.cs

示例8: TestRemoveMethod_AddingAndRemovingObjects

  public void TestRemoveMethod_AddingAndRemovingObjects()
  {
      DynamicList<int> arr = new DynamicList<int>();
      arr.Add(1);
      arr.Add(2);
      arr.Add(3);
      arr.Add(4);
 
      arr.Remove(1);
      Assert.AreEqual(3,arr.Count,"The removing method doesn't work correclty!");
  }
开发者ID:ZahariyaPehlivanova,项目名称:KPK-Unit-Testing-Homework,代码行数:11,代码来源:CustomLinkedListTests.cs

示例9: TestCountAfterRemoveElementFromList

        public void TestCountAfterRemoveElementFromList()
        {
            DynamicList<string> list = new DynamicList<string>();
            list.Add("first");
            list.Add("second");
            list.Add("third");

            list.Remove("second");
            int count = list.Count;

            Assert.AreEqual(2, count, "The count of elements of the list should be 2 after removing an element.");
        }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:12,代码来源:UnitTest1.cs

示例10: TestCountAfterRemoveExistingElement

        public void TestCountAfterRemoveExistingElement()
        {
            DynamicList<string> list = new DynamicList<string>();
            list.Add("first");
            list.Add("second");
            list.Add("third");
            int countBeforeRemoving = list.Count;

            list.Remove("second");
            int countAfterRemoving = list.Count;

            Assert.AreEqual(countAfterRemoving+1, countBeforeRemoving, "Count after removing must be less by 1.");
        }
开发者ID:IvanMladenov,项目名称:HomeWorksHQC,代码行数:13,代码来源:CustomLinkedListTest.cs

示例11: TestRemove

        public void TestRemove()
        {
            var dynamicList = new DynamicList<int>();
            var elementForRemove = 2;
            dynamicList.Add(0);
            dynamicList.Add(elementForRemove);
            dynamicList.Add(4);

            // Act
            var removedElementIndex = dynamicList.Remove(elementForRemove);

            // Assert
            Assert.AreEqual(dynamicList[1], 4, "Element for remove not removed.");
            Assert.AreEqual(2, dynamicList.Count, "Dynamic list not remove element.");
        }
开发者ID:ivayloivanof,项目名称:HQC,代码行数:15,代码来源:DynamicListTest.cs

示例12: IndexationTest

        public void IndexationTest()
        {
            DynamicList<double> nums = new DynamicList<double>();
            nums.Add(2.5);
            nums.Add(4);
            nums.Add(-100);

            Assert.AreEqual(2.5, nums[0], "Error in the indexation");
            Assert.AreEqual(4, nums[1], "Error in the indexation");

            nums.Remove(4);
            Assert.AreEqual(-100, nums[1], "Error in the indexation");

            nums[1] = 250.5;
            Assert.AreEqual(250.5, nums[1], "Error in the indexation");
        }
开发者ID:reminchev,项目名称:SoftUni-Projects,代码行数:16,代码来源:DynamicListTests.cs

示例13: RemoveNonExistingElement_NotSuccessful

        public void RemoveNonExistingElement_NotSuccessful()
        {
            var dynamicList = new DynamicList<int>();

            const int firstElement = 666;
            const int secondElement = 777;
            const int randomNumber = 9067576;
            dynamicList.Add(firstElement);
            dynamicList.Add(secondElement);

            var getElement = dynamicList.Remove(randomNumber);

            Assert.AreEqual(-1, getElement, "The returned element is not correct!");
        }
开发者ID:i-yotov,项目名称:Courses,代码行数:14,代码来源:DynamicListTests.cs

示例14: RemoveElement_ElementSuccessfullyRemoved

        public void RemoveElement_ElementSuccessfullyRemoved()
        {
            var dynamicList = new DynamicList<int>();

            const int firstElement = 666;
            const int secondElement = 777;
            dynamicList.Add(firstElement);
            dynamicList.Add(secondElement);

            dynamicList.Remove(firstElement);

            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!");
        }
开发者ID:i-yotov,项目名称:Courses,代码行数:14,代码来源:DynamicListTests.cs

示例15: RemoveExistingElement_Successful

        public void RemoveExistingElement_Successful()
        {
            var dynamicList = new DynamicList<int>();

            const int firstElement = 666;
            const int secondElement = 777;
            dynamicList.Add(firstElement);
            dynamicList.Add(secondElement);

            var getElement = dynamicList.Remove(firstElement);

            Assert.AreEqual(0, getElement, "The returned element is not correct!");
        }
开发者ID:i-yotov,项目名称:Courses,代码行数:13,代码来源:DynamicListTests.cs


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