public void removeElement_whenFound(IDeque <SimpleLinkedValue> deque)
        {
            SimpleLinkedValue first = deque.Peek();

            Assert.That(deque.Remove(first), Is.True);
            Assert.That(deque, HasCount((int)Capacity() - 1));
            Assert.That(deque.Contains(first), Is.False);
        }
        public void dequeue_whenPopulated(IDeque <SimpleLinkedValue> deque)
        {
            SimpleLinkedValue first = deque.Peek();

            Assert.That(deque.Dequeue(), Is.SameAs(first));
            Assert.That(deque, HasCount((int)Capacity() - 1));
            Assert.That(deque.Contains(first), Is.False);
        }
示例#3
0
        public void Contains_WithNulls()
        {
            for (int i = 0; i < ImplicitInt; i++)
            {
                deq.Add(null);
            }
            deq.Insert(ImplicitInt / 2, 5);

            Assert.IsTrue(deq.Contains(5));
        }
        public void dequeue_toEmpty(IDeque <SimpleLinkedValue> deque)
        {
            SimpleLinkedValue value;

            while (deque.Peek() != null)
            {
                value = deque.Dequeue();
                Assert.That(deque.Contains(value), Is.False);
            }
            Assert.That(deque, emptyCollection <SimpleLinkedValue>());
        }
示例#5
0
 public static object InContainer(IGraphProcessingEnvironment procEnv, object container, object value)
 {
     if (container is IList)
     {
         IList array = (IList)container;
         return(array.Contains(value));
     }
     else if (container is IDeque)
     {
         IDeque deque = (IDeque)container;
         return(deque.Contains(value));
     }
     else
     {
         IDictionary setmap = (IDictionary)container;
         return(setmap.Contains(value));
     }
 }
 public void contains_whenFound(IDeque <SimpleLinkedValue> deque)
 {
     Assert.That(deque.Contains(deque.ElementAt((int)Capacity() / 2)), Is.True);
 }
 public void contains_withNull(IDeque <SimpleLinkedValue> deque)
 {
     deque.Contains(null);
 }