Exemplo n.º 1
0
        public void Done()
        {
            var dequeeque = new Deque<int>();
            dequeeque.EnqueueHead(5);
            dequeeque.EnqueueHead(3);
            dequeeque.EnqueueHead(2);

            var visitor = new CompletedTrackingVisitor<int>();

            dequeeque.AcceptVisitor(visitor);
        }
Exemplo n.º 2
0
        public void Done()
        {
            var dequeeque = new Deque <int>();

            dequeeque.EnqueueHead(5);
            dequeeque.EnqueueHead(3);
            dequeeque.EnqueueHead(2);

            var visitor = new CompletedTrackingVisitor <int>();

            dequeeque.AcceptVisitor(visitor);
        }
Exemplo n.º 3
0
        public void Simple()
        {
            var deque = new Deque<int>();
            deque.EnqueueHead(5);
            deque.EnqueueHead(3);
            deque.EnqueueHead(2);

            var visitor = new TrackingVisitor<int>();

            deque.AcceptVisitor(visitor);

            Assert.AreEqual(visitor.TrackingList.Count, 3);
            Assert.IsTrue(visitor.TrackingList.Contains(5));
            Assert.IsTrue(visitor.TrackingList.Contains(3));
            Assert.IsTrue(visitor.TrackingList.Contains(2));
        }
Exemplo n.º 4
0
        public void Simple()
        {
            var deque = new Deque <int>();

            deque.EnqueueHead(5);
            deque.EnqueueHead(3);
            deque.EnqueueHead(2);

            var visitor = new TrackingVisitor <int>();

            deque.AcceptVisitor(visitor);

            Assert.AreEqual(visitor.TrackingList.Count, 3);
            Assert.IsTrue(visitor.TrackingList.Contains(5));
            Assert.IsTrue(visitor.TrackingList.Contains(3));
            Assert.IsTrue(visitor.TrackingList.Contains(2));
        }
Exemplo n.º 5
0
        public void AcceptVisitorExample()
        {
            var deque = new Deque<string>();
            deque.EnqueueHead("cat");
            deque.EnqueueHead("dog");
            deque.EnqueueHead("canary");

            // There should be 3 items in the deque.
            Assert.AreEqual(3, deque.Count);

            // Create a visitor that will simply count the items in the deque.
            var visitor =
                new CountingVisitor<string>();

            // Make deque call IVisitor<T>.Visit on all items contained.
            deque.AcceptVisitor(visitor);

            // The counting visitor would have visited 3 items.
            Assert.AreEqual(3, visitor.Count);
        }
Exemplo n.º 6
0
        public void AcceptVisitorExample()
        {
            var deque = new Deque <string>();

            deque.EnqueueHead("cat");
            deque.EnqueueHead("dog");
            deque.EnqueueHead("canary");

            // There should be 3 items in the deque.
            Assert.AreEqual(3, deque.Count);

            // Create a visitor that will simply count the items in the deque.
            var visitor =
                new CountingVisitor <string>();

            // Make deque call IVisitor<T>.Visit on all items contained.
            deque.AcceptVisitor(visitor);

            // The counting visitor would have visited 3 items.
            Assert.AreEqual(3, visitor.Count);
        }
Exemplo n.º 7
0
        public void ExceptionNullVisitor()
        {
            var dequeeque = new Deque <int>();

            dequeeque.AcceptVisitor(null);
        }
Exemplo n.º 8
0
 public void ExceptionNullVisitor()
 {
     var dequeeque = new Deque<int>();
     dequeeque.AcceptVisitor(null);
 }
Exemplo n.º 9
0
        public void ExceptionNullVisitor()
        {
            var dequeeque = new Deque <int>();

            Assert.Throws <ArgumentNullException>(() => dequeeque.AcceptVisitor(null));
        }