void AddToBoth() { for (int i = 0; i < implicitLength; i++) { int a = rint; deq.Add(a); fake.Add(a); } }
public void add_whenLinked(IDeque <SimpleLinkedValue> deque) { var sizeBefore = ((ICollection)deque).Count; deque.Add(deque.Peek()); Assert.That(deque, HasCount(sizeBefore)); }
public void add_whenPopulated(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue value = new SimpleLinkedValue((int)Capacity()); deque.Add(value); Assert.That(deque.Peek(), Is.Not.SameAs(value)); Assert.That(deque, HasCount((int)Capacity() + 1)); }
public void add_whenEmpty(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue value = new SimpleLinkedValue(1); deque.Add(value); Assert.That(deque.Peek(), Is.SameAs(value)); Assert.That(deque, HasCount(1)); }
public static void FillDequeWithVar(IDeque targetDeque, Type varType, IDeque sourceDeque) { foreach (object entry in sourceDeque) { if (entry.GetType() == varType) { targetDeque.Add(entry); } } }
public static IDeque Subdeque(IDeque a, int start, int length) { IDeque newDeque = (IDeque)Activator.CreateInstance(a.GetType()); for (int i = start; i < start + length; ++i) { newDeque.Add(a[i]); } return(newDeque); }
/// <summary> /// Creates a new deque containing all values from the given list. /// </summary> public static IDeque ArrayAsDeque(IList a) { Type valueType; ContainerHelper.GetListType(a, out valueType); IDeque newDeque = NewDeque(valueType); for (int i = 0; i < a.Count; ++i) { newDeque.Add(a[i]); } return(newDeque); }
public static void FillDequeWithEdge(IDeque targetDeque, EdgeType edgeType, IDeque sourceDeque) { foreach (object entry in sourceDeque) { IEdge edge = entry as IEdge; if (edge == null) { continue; } if (edge.InstanceOf(edgeType)) { targetDeque.Add(entry); } } }
public static void FillDequeWithNode(IDeque targetDeque, NodeType nodeType, IDeque sourceDeque) { foreach (object entry in sourceDeque) { INode node = entry as INode; if (node == null) { continue; } if (node.InstanceOf(nodeType)) { targetDeque.Add(entry); } } }
public static IDeque Copy(IDeque deque, IGraph graph, IDictionary <IBaseObject, IBaseObject> oldToNewObjects) { IDeque copy = (IDeque)Activator.CreateInstance(deque.GetType()); foreach (object element in deque) { if (element is IObject) { IObject elem = (IObject)element; copy.Add(elem.Copy(graph, oldToNewObjects)); } else if (element is ITransientObject) { ITransientObject elem = (ITransientObject)element; copy.Add(elem.Copy(graph, oldToNewObjects)); } else { copy.Add(element); } } return(copy); }
public void TestCount() { for (int i = 0; i < TestView.implicitLength; i++) { deq.Add(TestView.rint); } deq = deq.GetReverseView(); for (int i = 0; i < TestView.implicitLength; i++) { deq.Add(TestView.rint); } IDeque <int> deq2 = deq.GetReverseView(); Assert.AreEqual(deq.Count, deq2.Count); }
public void Add_Null() { deq.Add(null); fake.Add(null); Assert.AreEqual(fake[0], deq[0]); }