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

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

            stack.Push("p");
            stack.Push("q");
            stack.Lock();
            //  Assert
            stack.Peek();   // No exceptio thrown - unchecked.
        }
Exemple #3
0
        public void Simple_PeekAndPeekItem_Test()
        {
            //  Arrange
            var stack = new UncheckedLayeredStack <string>();

            //  Act
            stack.Push("a");
            stack.Push("b");
            var b = stack.Peek();
            var a = stack.PeekItem(1);

            //  Assert
            Assert.Equal("b", b);
            Assert.Equal("a", a);
        }