public void ToList_ItemsEnqueuedToExceedCapacity_EarlierValuesOverridenWhenPastCapacity()
        {
            List <int> values   = Enumerable.Range(1, Random.Next(100, 1000)).Select(n => Random.Next()).ToList();
            long       capacity = Random.Next(20, values.Count / 2);
            CyclicConcurrentQueue <int> cyclicConcurrentQueue = CreateCyclicConcurrentQueue <int>(capacity);

            foreach (int value in values)
            {
                cyclicConcurrentQueue.Enqueue(value);
            }
            List <int> expectedValues = values.Skip(values.Count - (int)capacity).ToList();

            CollectionAssert.AreEqual(expectedValues, cyclicConcurrentQueue.ToList());
        }
        public void ToList_InitialCollectionAndItemsEnqueuedWithinCapacity_MatchesInitialCollectionAndExtraItemAtEnd()
        {
            List <int> initialValues = Enumerable.Range(1, Random.Next(10, 100)).Select(n => Random.Next()).ToList();
            List <int> addedValues   = Enumerable.Range(1, Random.Next(10, 100)).Select(n => Random.Next()).ToList();
            long       capacity      = initialValues.Count + addedValues.Count + Random.Next(1, 100);
            CyclicConcurrentQueue <int> cyclicConcurrentQueue = CreateCyclicConcurrentQueue(initialValues, capacity);

            foreach (int addedValue in addedValues)
            {
                cyclicConcurrentQueue.Enqueue(addedValue);
            }
            List <int> expectedValues = initialValues.Concat(addedValues).ToList();

            CollectionAssert.AreEqual(expectedValues, cyclicConcurrentQueue.ToList());
        }
        ToList_ItemsEnqueuedToExceedCapacityThenItemsDequeued_EarlierValuesOverridenWhenPastCapacityThenQueueShortenedOnDequeue
            ()
        {
            List <int> values          = Enumerable.Range(1, Random.Next(100, 1000)).Select(n => Random.Next()).ToList();
            long       capacity        = Random.Next(20, values.Count / 2);
            int        amountToDequeue = Random.Next(1, (int)capacity / 2);
            CyclicConcurrentQueue <int> cyclicConcurrentQueue = CreateCyclicConcurrentQueue <int>(capacity);

            foreach (int value in values)
            {
                cyclicConcurrentQueue.Enqueue(value);
            }
            for (int i = 0; i < amountToDequeue; i++)
            {
                int dequeued;
                Assert.IsTrue(
                    cyclicConcurrentQueue.TryDequeue(out dequeued),
                    "This test should always succeed when attempting to Dequeue elements.");
            }
            List <int> expectedValues = values.Skip(values.Count - (int)capacity).Skip(amountToDequeue).ToList();

            CollectionAssert.AreEqual(expectedValues, cyclicConcurrentQueue.ToList());
        }