public void Deque_ForEach_Iteration_Modified(int count)
 {
     var elements = new TestDequeElement[count];
     for (var i = 0; i < count; i++)
     {
         elements[i] = new TestDequeElement
         {
             Value = i
         };
     }
     var deque = new Deque<TestDequeElement>(elements);
     var counter = 0;
     foreach (var element in deque)
     {
         Assert.IsTrue(element.Value == counter);
         counter++;
         deque.RemoveFromFront();
     }
 }
        public void Deque_Remove_Front(int count)
        {
            var elements = new TestDequeElement[count];
            for (var i = 0; i < count; i++)
            {
                elements[i] = new TestDequeElement
                {
                    Value = i
                };
            }
            var deque = new Deque<TestDequeElement>(elements);

            TestDequeElement element;
            var index = 0;
            while (deque.RemoveFromFront(out element))
            {
                Assert.IsTrue(element.Value == index);
                index++;
            }
        }
 public void Deque_Get_Front(int count)
 {
     var elements = new TestDequeElement[count];
     for (var i = 0; i < count; i++)
     {
         elements[i] = new TestDequeElement
         {
             Value = i
         };
     }
     var deque = new Deque<TestDequeElement>(elements);
     var indices = Enumerable.Range(0, count);
     foreach (var index in indices)
     {
         TestDequeElement element;
         deque.GetFront(out element);
         deque.RemoveFromFront();
         Assert.IsTrue(element.Value == index);
     }
 }
        public void Deque_Trim_Front(int count)
        {
            var elements = new TestDequeElement[count];
            for (var i = 0; i < count; i++)
            {
                elements[i] = new TestDequeElement
                {
                    Value = i
                };
            }
            var deque = new Deque<TestDequeElement>(elements);

            for (var i = 0; i < count; i++)
            {
                TestDequeElement element;
                deque.RemoveFromFront(out element);
                deque.Capacity = deque.Count;
                Assert.IsTrue(deque.Count == count - 1 - i);
                Assert.IsTrue(deque.Capacity == count - 1 - i);
            }
        }