public void GetEnumerator_AtCapacityAndItemEnqueuedWhilstIterating_IterationCountNeverExceedsCapacity()
        {
            List <int> initialValues = Enumerable.Range(1, Random.Next(10, 10000)).Select(n => Random.Next()).ToList();
            long       capacity      = initialValues.Count;
            CyclicConcurrentQueue <int> cyclicConcurrentQueue = CreateCyclicConcurrentQueue(initialValues, capacity);
            List <int> iterationResult = new List <int>();
            List <int> enqueuedValues  = Enumerable.Range(1, Random.Next(1, 100)).Select(n => Random.Next()).ToList();

            using (IEnumerator <int> enumerator = cyclicConcurrentQueue.GetEnumerator())
            {
                //Start iterating a single time
                enumerator.MoveNext();
                iterationResult.Add(enumerator.Current);

                //Add extra values
                foreach (int enqueuedValue in enqueuedValues)
                {
                    cyclicConcurrentQueue.Enqueue(enqueuedValue);
                }

                //Finish iterating
                while (enumerator.MoveNext())
                {
                    iterationResult.Add(enumerator.Current);
                }
            }
            Assert.IsTrue(
                capacity >= iterationResult.Count,
                "Iteration count ({0}) should always be smaller than the capacity ({1})",
                iterationResult.Count,
                capacity);
        }
        public void GetEnumerator_ItemEnqueuedAfterGetAndBeforeIterating_EnqueuedValueIncludedInIteration()
        {
            List <int> initialValues = Enumerable.Range(1, Random.Next(10, 10000)).Select(n => Random.Next()).ToList();
            long       capacity      = Random.Next(10, MaxCapacity);
            CyclicConcurrentQueue <int> cyclicConcurrentQueue = CreateCyclicConcurrentQueue(initialValues, capacity);
            List <int> iterationResult = new List <int>();
            int        enqueued        = Random.Next();

            using (IEnumerator <int> enumerator = cyclicConcurrentQueue.GetEnumerator())
            {
                cyclicConcurrentQueue.Enqueue(enqueued);
                while (enumerator.MoveNext())
                {
                    iterationResult.Add(enumerator.Current);
                }
            }
            Assert.AreEqual(enqueued, iterationResult.Last());
        }