Beispiel #1
0
        public void AtFunctionShouldThrowExceptionWhenStackIsEmpty()
        {
            var stack = new MyStack();
            int index = 4;

            Assert.Throws <IndexOutOfRangeException>(() => stack.At(index));
        }
Beispiel #2
0
        public void AtFunctionShouldReturnProperElementFromIndex()
        {
            var stack = new MyStack();
            int index = 0;

            stack.Push(TEST_ELEMENT);

            Assert.AreEqual(TEST_ELEMENT, stack.At(index));
        }
Beispiel #3
0
        public void AtFunctionShouldThrowExceptionWhenIndexIsGreaterThanStackSize()
        {
            var stack = new MyStack();
            int index = 2;

            stack.Push(TEST_ELEMENT);

            Assert.Throws <IndexOutOfRangeException>(() => stack.At(index));
        }