public static void PeekTest()
        {
            var stack = new ListBasedStack <int>(new[] { 0, 1, 2, 3, 4 });

            Assert.IsTrue(stack.Peek() == 4);
            Assert.IsTrue(stack.Peek() == 4);
            Assert.IsTrue(stack.Peek() == 4);
        }
Ejemplo n.º 2
0
        public static void PeekTest()
        {
            var stack = new ListBasedStack <int>(new[] { 0, 1, 2, 3, 4 });

            Assert.Multiple(() =>
            {
                stack.Peek().Should().Be(4);
                stack.Peek().Should().Be(4);
                stack.Peek().Should().Be(4);
            });
        }
        public static void PushTest()
        {
            var stack = new ListBasedStack <int>();

            stack.Push(0);
            Assert.IsTrue(stack.Peek() == 0);
            stack.Push(1);
            Assert.IsTrue(stack.Peek() == 1);
            stack.Push(2);
            Assert.IsTrue(stack.Peek() == 2);
            stack.Push(3);
            Assert.IsTrue(stack.Peek() == 3);
            stack.Push(4);
            Assert.IsTrue(stack.Peek() == 4);
        }
Ejemplo n.º 4
0
        public static void PushTest()
        {
            var stack = new ListBasedStack <int>();

            Assert.Multiple(() =>
                            Enumerable.Range(0, 5)
                            .ToList()
                            .ForEach(number =>
            {
                stack.Push(number);
                stack.Peek().Should().Be(number);
            }));
        }