Exemplo n.º 1
0
        public void TestInts()
        {
            dynamic stack = new FixedSizeStack <int>(50);

            var test1 = 1;
            var test2 = 2;
            var test3 = 3;

            stack.Push(test1);
            stack.Push(test2);
            stack.Push(test3);

            Assert.AreEqual(3, stack.Size);

            Assert.AreEqual(test3, stack.Pop());
            Assert.AreEqual(test2, stack.Pop());
            Assert.AreEqual(test1, stack.Pop());
        }
Exemplo n.º 2
0
        public void TestStrings()
        {
            dynamic stack = new FixedSizeStack <string>(50);

            var test1 = "Hi stack.";
            var test2 = "Hi again, stack";
            var test3 = "How's it going, stack?";

            stack.Push(test1);
            stack.Push(test2);
            stack.Push(test3);

            Assert.AreEqual(3, stack.Size);

            Assert.AreEqual(test3, stack.Pop());
            Assert.AreEqual(test2, stack.Pop());
            Assert.AreEqual(test1, stack.Pop());
        }