本文整理汇总了C#中DoublyLinkedList.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# DoublyLinkedList.Contains方法的具体用法?C# DoublyLinkedList.Contains怎么用?C# DoublyLinkedList.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoublyLinkedList
的用法示例。
在下文中一共展示了DoublyLinkedList.Contains方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contains
public void Contains()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
list.Add(3);
list.Add(5);
list.Add(7);
bool isTrue = list.Contains(3);
Assert.AreEqual(true, isTrue);
}
示例2: Contains
public void Contains()
{
var list = new DoublyLinkedList<int>(new[] { 1, 2, 3 });
Assert.IsTrue(list.Contains(1));
Assert.IsFalse(list.Contains(10));
}
示例3: Find
public void Find()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
list.Add(3);
list.Add(5);
list.Add(7);
list.Contains(7).ShouldBeTrue();
list.Contains(2).ShouldBeFalse();
}
示例4: RemoveTailPUT
public void RemoveTailPUT([PexAssumeUnderTest]IList<int> values, int randomPick1)
{
PexAssume.AreDistinctValues<int>(values as int[]);
PexAssume.IsTrue(values.Contains(randomPick1));
DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
bool tail = dll.Tail.Value == randomPick1 ? true:false;
bool head = dll.Head.Value == randomPick1 ? true : false;
PexObserve.ValueForViewing<bool>("isTail", tail);
PexObserve.ValueForViewing<bool>("isHead", head);
dll.Remove(randomPick1);
PexAssert.AreEqual(values.Count - 1, dll.Count);
if (values.Count == 1)
{
PexAssert.IsTrue(dll.IsEmpty());
//PexGoal.Reached("g1");
return;
}
if (values.Count == 2)
{
PexAssert.AreEqual(dll.Head, dll.Tail);
//PexGoal.Reached("g2");
}
if (tail)
{
PexAssert.AreEqual(values[values.Count - 2], dll.Tail.Value);
//PexGoal.Reached("g3");
}
if (head)
{
PexAssert.AreEqual(values[1], dll.Head.Value);
// PexGoal.Reached("g4");
}
PexAssert.IsFalse(dll.Contains(randomPick1));
}
示例5: ContainsPUT
public void ContainsPUT([PexAssumeUnderTest]IList<int> values, int randomPick1, int randomPick2)
{
PexAssume.IsTrue(values.Contains(randomPick1));
PexAssume.IsFalse(values.Contains(randomPick2));
DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
PexAssert.IsTrue(dll.Contains(randomPick1));
PexAssert.IsFalse(dll.Contains(randomPick2));
}
示例6: ContainsTest
public void ContainsTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};
Assert.IsTrue(dll.Contains(20));
Assert.IsFalse(dll.Contains(40));
}