Exemple #1
0
        public void SimplePop_Pop_Test()
        {
            //  Arrange
            var stack = new UncheckedLayeredStack <string>();

            stack.Push("a");
            stack.Push("b");
            //  Act
            var b = stack.Pop();
            var a = stack.Pop();

            //  Assert
            Assert.True(stack.IsEmpty());
            Assert.Equal(0, stack.Size());
            Assert.Equal("b", b);
            Assert.Equal("a", a);
        }
Exemple #2
0
        public void CannotPopEmpty_Pop_Test()
        {
            //  Arrange
            var stack = new UncheckedLayeredStack <string>();

            //  Assert
            Assert.Throws <NutmegException>(() => stack.Pop());
        }
Exemple #3
0
        public void CannotPopEmptyLocked_Pop_Test()
        {
            //  Arrange
            var stack = new UncheckedLayeredStack <string>();

            stack.Push("p");
            stack.Push("q");
            stack.Lock();
            //  Assert
            stack.Pop();    //  Does not throw an exception. Unchecked.
        }