Пример #1
0
        public void ClearTest()
        {
            var emptyQueue = ImmutableQueue.Create <GenericParameterHelper>();

            AssertAreSame(emptyQueue, emptyQueue.Clear());
            var nonEmptyQueue = emptyQueue.Enqueue(new GenericParameterHelper(3));

            AssertAreSame(emptyQueue, nonEmptyQueue.Clear());

            // Interface test
            IImmutableQueue <GenericParameterHelper> queueInterface = nonEmptyQueue;

            AssertAreSame(emptyQueue, queueInterface.Clear());
        }
Пример #2
0
        public void TestClear()
        {
            ImmutableTreeQueue <int> queue = ImmutableTreeQueue <int> .Empty;

            Assert.Same(queue, queue.Clear());

            foreach (int item in Enumerable.Range(0, 10))
            {
                queue = queue.Enqueue(item);
            }

            Assert.NotEmpty(queue);
            Assert.Same(ImmutableTreeQueue <int> .Empty, queue.Clear());

            // Test through the IImmutableQueue<T> interface
            IImmutableQueue <int> immutableQueue = queue;

            Assert.NotEmpty(immutableQueue);
            Assert.Same(ImmutableTreeQueue <int> .Empty, immutableQueue.Clear());
        }
Пример #3
0
 public static IImmutableQueue <T> clear <T>(IImmutableQueue <T> queue) =>
 queue.Clear();