Пример #1
0
        public void should_return_false_when_trypop_from_empty()
        {
            IStack <int> stack = new Services.Stack <int>();

            int result;

            stack.TryPop(out result).Should().BeFalse();
        }
Пример #2
0
        public void should_return_true_when_trypop_after_push()
        {
            IStack <int> stack = new Services.Stack <int>();

            stack.Push(123);

            int  popped;
            bool result = stack.TryPop(out popped);

            result.Should().BeTrue();
            popped.Should().Be(123);
        }
Пример #3
0
        public void should_still_contain_items_after_trypop()
        {
            IStack <int> stack = new Services.Stack <int>();

            stack.Push(321);

            int popped;

            stack.TryPop(out popped);

            Action act = () => stack.Pop();

            act.Should().NotThrow();
        }