Exemple #1
0
        public void Dequeue()
        {
            var queue = new Queue <string>();

            try
            {
                queue.Dequeue();
                Assert.Fail();
            }
            catch (InvalidOperationException) { }

            queue = new Queue <string>(Globals.Strings);
            var system = new S.Queue <string>(Globals.Strings);

            while (queue.Count != 0)
            {
                Assert.IsTrue(queue.Dequeue() == system.Dequeue());
                Comparer <string> .Compare(queue, system);
            }

            Assert.IsTrue(queue.Count == system.Count && queue.Count == 0);

            try
            {
                queue.Dequeue();
                Assert.Fail();
            }
            catch (InvalidOperationException) { }
        }
Exemple #2
0
        public void TryDequeue()
        {
            var queue  = new Queue <string>(Globals.Strings);
            var system = new S.Queue <string>(Globals.Strings);

            while (queue.TryDequeue(out string first))
            {
                Assert.IsTrue(first == system.Dequeue());
                Comparer <string> .Compare(queue, system);
            }

            Comparer <string> .Compare(queue, system);

            Assert.IsFalse(queue.TryDequeue(out _));
        }