本文整理汇总了C#中DoublyLinkedList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# DoublyLinkedList.Remove方法的具体用法?C# DoublyLinkedList.Remove怎么用?C# DoublyLinkedList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoublyLinkedList
的用法示例。
在下文中一共展示了DoublyLinkedList.Remove方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveForASingleItemList
public void RemoveForASingleItemList()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
list.AddAtTail(7);
list.Remove(7);
list.ShouldBeEmpty();
}
示例2: RemoveForEmptyList
public void RemoveForEmptyList()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
list.Remove(7);
}
示例3: 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));
}
示例4: RemoveForAListWithTwoItems
public void RemoveForAListWithTwoItems()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[5];
list.Add(7);
list.Add(6);
list.Add(5);
list.Add(4);
list.Add(3);
list.CopyTo(array, 0);
list.Remove(5);
list.CopyTo(array, 0);
list.ShouldNotContain(5);
list.ShouldContain(3);
}
示例5: RemoveTailTwoNodes
public void RemoveTailTwoNodes()
{
DoublyLinkedList<string> dll = new DoublyLinkedList<string> {"London", "Paris"};
dll.Remove("Paris");
Assert.AreEqual("London", dll.Head.Value);
Assert.AreEqual("London", dll.Tail.Value);
Assert.AreEqual(1, dll.Count);
}
示例6: RemovePUT
public void RemovePUT([PexAssumeUnderTest]IList<int> values, int randomPick)
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
if (!values.Contains(randomPick))
PexAssert.IsFalse(dll.Remove(randomPick));
else
PexAssert.IsTrue(dll.Remove(randomPick));
}
示例7: RemoveSingleNodeTest
public void RemoveSingleNodeTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};
dll.Remove(10);
Assert.IsTrue(dll.IsEmpty());
Assert.IsNull(dll.Head);
Assert.IsNull(dll.Tail);
Assert.AreEqual(0, dll.Count);
}
示例8: RemoveTailMultipleNodesTest
public void RemoveTailMultipleNodesTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};
dll.Remove(30);
Assert.AreEqual(20, dll.Tail.Value);
Assert.IsNull(dll.Tail.Next);
Assert.AreEqual(2, dll.Count);
}
示例9: RemoveNoMatchTest
public void RemoveNoMatchTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};
Assert.IsFalse(dll.Remove(20));
}
示例10: RemoveMiddleMultipleNodesTest
public void RemoveMiddleMultipleNodesTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};
dll.Remove(20);
Assert.AreEqual(30, dll.Head.Next.Value);
Assert.AreEqual(10, dll.Tail.Previous.Value);
Assert.AreEqual(2, dll.Count);
}
示例11: RemoveHeadMultipleNodesTest
public void RemoveHeadMultipleNodesTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10, 20, 30};
dll.Remove(10);
Assert.AreEqual(20, dll.Head.Value);
Assert.IsNull(dll.Head.Previous);
Assert.AreEqual(2, dll.Count);
}
示例12: RemoveEmptyListTest
public void RemoveEmptyListTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int>();
Assert.IsFalse(dll.Remove(10));
}
示例13: TestDoublyLinkedListRemove
public void TestDoublyLinkedListRemove()
{
DoublyLinkedList<string> list = new DoublyLinkedList<string>();
list.Add("One");
list.Add("Two");
list.Add("Three");
list[0] = "Zero";
list.Remove("Three");
string[] array = new string[list.Count];
list.CopyTo(array);
Assert.AreEqual("Zero, Two", string.Join(", ", array));
}