예제 #1
0
        public void Pushing_items_and_Popping_results_in_LIFO_action()
        {
            var stack = new MyStack();

            stack.Push("1");
            stack.Push("2");
            stack.Push("3");

            var result1 = stack.Pop();
            var result2 = stack.Pop();
            var result3 = stack.Pop();

            Assert.AreEqual("3", result1);
            Assert.AreEqual("2", result2);
            Assert.AreEqual("1", result3);
        }
예제 #2
0
        public void Pushing_invalid_value_throws_error()
        {
            var stack = new MyStack();

            Assert.ThrowsException <ArgumentException>(() => stack.Push(null));
        }