本文整理汇总了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.");
}
示例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);
}
示例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);
}
示例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.");
}
示例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.");
}
示例6: TestContainsEmptyList_ShouldReturnFalse
public void TestContainsEmptyList_ShouldReturnFalse()
{
// Arrange
var list = new DynamicList<int>();
// Act
bool contains = list.Contains(22);
// Assert
Assert.IsFalse(contains);
}
示例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.");
}
示例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.");
}
示例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.");
}
示例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!");
}
示例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");
}
示例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);
}
示例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);
}
示例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");
}
示例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.");
}