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);
        }
Example #2
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);
            }));
        }