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


C# DynamicList.Contains方法代码示例

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


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

示例1: AddContainsAndIndexOfTest

        public void AddContainsAndIndexOfTest()
        {
            DynamicList<string> words = new DynamicList<string>();
            words.Add("Pesho");
            words.Add("Strahil");
            Assert.AreEqual(2, words.Count, "Error in the adding command.");

            Assert.IsFalse(words.Contains("Ivan"), "Contains method works incorectly.");
            Assert.IsTrue(words.Contains("Pesho"), "Error in adding or contains.");

            Assert.AreEqual(-1, words.IndexOf("Ivan"), "Error in indexOf method.");
            Assert.AreNotEqual(-1, words.IndexOf("Strahil"), "Error in indexOf method.");
        }
开发者ID:reminchev,项目名称:SoftUni-Projects,代码行数:13,代码来源:DynamicListTests.cs

示例2: Contains_ToAlreadyInitializedList_ShouldReturnTrueOrFalse

        public void Contains_ToAlreadyInitializedList_ShouldReturnTrueOrFalse()
        {
            var list = new DynamicList<long>();
            list.Add(123870814435);
            list.Add(-3275475243432);
            list.Add(9864354472332);
            list.Add(4574552354354756756);
            list.Add(92385023497544325);

            var firstNum = list.Contains(4);
            var secondNum = list.Contains(9864354472332);

            Assert.IsFalse(firstNum);
            Assert.IsTrue(secondNum);
        }
开发者ID:hristodobrev,项目名称:Software-University,代码行数:15,代码来源:DynamicListTest.cs

示例3: TestContains_NExistingElement_ShouldReturnPositive

 public void TestContains_NExistingElement_ShouldReturnPositive()
 {
     var list = new DynamicList<int>();
     list.Add(5);
     var isContains = list.Contains(5);
     Assert.IsTrue(isContains);
 }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:7,代码来源:TestDynamicListIndexOfAndContains.cs

示例4: Contains_ToEmptyList_ShouldReturnFalse

        public void Contains_ToEmptyList_ShouldReturnFalse()
        {
            var list = new DynamicList<double>();

            var doesContain = list.Contains(2.532);

            Assert.IsFalse(doesContain, "Must return false when the list is empty.");
        }
开发者ID:hristodobrev,项目名称:Software-University,代码行数:8,代码来源:DynamicListTest.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: TestContainsEmptyList_ShouldReturnFalse

 public void TestContainsEmptyList_ShouldReturnFalse()
 {
     // Arrange
     var list = new DynamicList<int>();
     // Act
     bool contains = list.Contains(22);
     // Assert
     Assert.IsFalse(contains);
 }
开发者ID:ikolev94,项目名称:Homeworks,代码行数:9,代码来源:LinkedListTest.cs

示例7: AddingElementShouldContainElement

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

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

示例8: Test_ContainsOnExisingElement

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

            var isFound = list.Contains("second");

            Assert.IsTrue(isFound, "The element is in the list and Contains should return true.");
        }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:10,代码来源:DynamicListTest.cs

示例9: TestContainsOnNonExisingElement

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

            bool isFound = list.Contains("third");

            Assert.IsFalse(isFound, "The element is not in the list and Contains should return false.");
        }
开发者ID:ivailojordanov,项目名称:Fundamental-Level,代码行数:10,代码来源:UnitTest1.cs

示例10: Test_DynamicListContain_ShouldReturnTrue

        public void Test_DynamicListContain_ShouldReturnTrue()
        {
            DynamicList<string> testList = new DynamicList<string>();
            string item = "dynamic";

            testList.Add(item);
            bool actual = testList.Contains(item);

            Assert.AreEqual(true, actual, "Did not return true when find the item in the list!");
        }
开发者ID:dhristoskov,项目名称:HighQualityCode,代码行数:10,代码来源:LinkedListTests.cs

示例11: TestContainsWithNonExistingElement

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

            bool result = list.Contains(5);

            Assert.AreEqual(false,result,"If list not contains element should return false");
        }
开发者ID:IvanMladenov,项目名称:HomeWorksHQC,代码行数:11,代码来源:CustomLinkedListTest.cs

示例12: TestContainsFullList_ShouldReturnTrue

 public void TestContainsFullList_ShouldReturnTrue()
 {
     // Arrange
     var list = new DynamicList<int>();
     list.Add(3);
     list.Add(1);
     // Act
     bool contains = list.Contains(3);
     // Assert
     Assert.IsTrue(contains);
 }
开发者ID:ikolev94,项目名称:Homeworks,代码行数:11,代码来源:LinkedListTest.cs

示例13: Contains_CheckForNonExistingElement_ShouldReturnFalse

        public void Contains_CheckForNonExistingElement_ShouldReturnFalse()
        {
            var list = new DynamicList<string>();
            list.Add("Test");
            list.Add("All");
            list.Add("Methods!");

            bool expected = false;
            bool actual = list.Contains("What?");

            Assert.AreEqual(expected, actual);
        }
开发者ID:msmilkoff,项目名称:HighQualityCodeHomeworks,代码行数:12,代码来源:UnitTest1.cs

示例14: ContainsTest

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

            list.Add(1);
            list.Add(2);
            list.Add(3);

            var result = list.Contains(2);

            Assert.IsTrue(result, "List does not search correctly");
        }
开发者ID:zhecho1215,项目名称:Softuni,代码行数:12,代码来源:DynamicListTests.cs

示例15: TestContains_ShouldReturnFalseForElementsNotInTheList

        public void TestContains_ShouldReturnFalseForElementsNotInTheList()
        {
            // Arrange
            DynamicList<int> testList = new DynamicList<int>();

            // Act
            FillTestListWith10Elements(testList);
            bool test = testList.Contains(51);

            // Assert
            Debug.Assert(test == false, "Checking for non existing elements should return false.");
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:12,代码来源:LinkedListTests.cs


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