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


C# DynamicList.Add方法代码示例

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


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

示例1: TestCountAfterAddTwoElementsToList

 public void TestCountAfterAddTwoElementsToList()
 {
     DynamicList<int> list = new DynamicList<int>();
     list.Add(1);
     list.Add(2);
     int count = list.Count;
     Assert.AreEqual(2, count, "List count should be 2 after adding two elements.");
 }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:8,代码来源:UnitTest1.cs

示例2: TestAddingNodeOnNonExistingPositivePositionMustThrowArgumentOutOfRangeException

 public void TestAddingNodeOnNonExistingPositivePositionMustThrowArgumentOutOfRangeException()
 {
     var list = new DynamicList<int>();
     list.Add(1);
     list.Add(1);
     list.Add(1);
     list[3] = 3;
 }
开发者ID:Jazastry,项目名称:SoftUni,代码行数:8,代码来源:DynamicListTests.cs

示例3: ChangeValueOfGivenPositionShoudChangeTheValueAtThisPosition

 public void ChangeValueOfGivenPositionShoudChangeTheValueAtThisPosition()
 {
     var numList = new DynamicList<int>();
     numList.Add(2);
     numList.Add(-10);
     numList[0] = 9;
     Assert.AreEqual(numList[0], 9, "The value is not equal to the expected change.");
 }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:8,代码来源:DynamicListsTests.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: ListElementsCheckingElementNotInTheListShoudNotContainElement

        public void ListElementsCheckingElementNotInTheListShoudNotContainElement()
        {
            var list = new DynamicList<int>();
            list.Add(1);
            list.Add(2);

            Assert.IsFalse(list.Contains(6), "The list must not contain 6.");
        }
开发者ID:alex687,项目名称:SoftUni-Homeworks,代码行数:8,代码来源:DynamicListTest.cs

示例6: GetElementWithIncorrectIndexShoudThrowArgumentNullException

 public void GetElementWithIncorrectIndexShoudThrowArgumentNullException()
 {
     var list = new DynamicList<int>();
     
     list.Add(2);
     list.Add(6);
     int element = list[2];
 }
开发者ID:alex687,项目名称:SoftUni-Homeworks,代码行数:8,代码来源:DynamicListTest.cs

示例7: FoundingElementInListShouldReturnIndexOfElement

 public void FoundingElementInListShouldReturnIndexOfElement()
 {
     var numList = new DynamicList<int>();
     numList.Add(13);
     numList.Add(-6);
     int index = numList.IndexOf(-6);
     Assert.AreEqual(1, index, "Invalid index.");
 }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:8,代码来源:DynamicListsTests.cs

示例8: TestCountAfterTwoElementsAdded

 public void TestCountAfterTwoElementsAdded()
 {
     var list = new DynamicList<int>();
     list.Add(1);
     list.Add(2);
     var count = list.Count;
     Assert.AreEqual(2, count, "List count should be 2 after adding two elements.");
 }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:8,代码来源:DynamicListTests.cs

示例9: Test_IndexGetReturnsThirdElementOneHundread

 public void Test_IndexGetReturnsThirdElementOneHundread()
 {
     var dynList = new DynamicList<int>();
     dynList.Add(10);
     dynList.Add(50);
     dynList.Add(100);
     Assert.AreEqual(100, dynList[2], "Index do not returns the correct value of an element at specified index.");
 }
开发者ID:tormibg,项目名称:SoftUni-1,代码行数:8,代码来源:DynamicList.Test.cs

示例10: AddingMoreElementsShouldIncreaseTheElemetsCount

 public void AddingMoreElementsShouldIncreaseTheElemetsCount()
 {
     var numList = new DynamicList<int>();
     numList.Add(2);
     numList.Add(-10);
     numList.Add(5);
     Assert.AreEqual(3, numList.Count, "The list count is not equal to the number of added elements.");
 }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:8,代码来源:DynamicListsTests.cs

示例11: 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

示例12: 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

示例13: SettingElementAtOutOfRangePositionInNoneEmptyDynamicListOfIntsShouldThrowException

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

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

示例14: 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

示例15: TestCountAfterRemoveNonExistingElementFromList

        public void TestCountAfterRemoveNonExistingElementFromList()
        {
            DynamicList<string> list = new DynamicList<string>();
            list.Add("one");
            list.Add("two");
            int count = list.Count;

            Assert.AreEqual(2, count, "The count of the list should remain unchanged after trying to remove a non-existing element.");
        }
开发者ID:svetlozarkirkov,项目名称:HighQualityCode-Homeworks,代码行数:9,代码来源:DynamicListTests.cs


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