示例#1
0
 public void testPopEmptyStack()
 {
     // ARRANGE
     StackLabCode.stack myStack = new StackLabCode.stack(1);
     // ACT
     // ASSERT
     Assert.Throws <StackLabCode.StackEmptyException>(() => myStack.pop());
 }
示例#2
0
        public void testPopStack()
        {
            // ARRANGE
            StackLabCode.stack myStack = new StackLabCode.stack(2);
            string             item = "StackItem";
            string             actual1, actual2, expected1, expected2;

            expected1 = "StackItem2";
            expected2 = "StackItem1";
            myStack.push(item + "1");
            myStack.push(item + "2");
            // ACT
            actual1 = myStack.pop();
            actual2 = myStack.pop();
            // ASSERT
            Assert.Equal(expected1, actual1);
            Assert.Equal(expected2, actual2);
            Assert.True(myStack.isEmpty());
        }