Пример #1
0
 public void testPeekEmptyStack()
 {
     // ARRANGE
     StackLabCode.stack myStack = new StackLabCode.stack(1);
     // ACT
     // ASSERT
     Assert.Throws <StackLabCode.StackEmptyException>(() => myStack.peek());
 }
Пример #2
0
        public void testPeekStack()
        {
            // ARRANGE
            StackLabCode.stack myStack = new StackLabCode.stack(1);
            string             item = "StackItem";
            string             actual, expected;

            // ACT
            myStack.push(item);
            expected = item;
            actual   = myStack.peek();
            // ASSERT
            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void testPushStack()
        {
            // ARRANGE
            StackLabCode.stack myStack = new StackLabCode.stack(2);
            string             item = "StackItem";
            string             expected, actual;

            expected = "StackItem2";
            // ACT
            myStack.push(item + "1");
            myStack.push(item + "2");
            actual = myStack.peek();
            // ASSERT
            Assert.False(myStack.isEmpty());
            Assert.Equal(expected, actual);
        }