public virtual void TestPushPop() { Stack4 stack = new Stack4(); AssertEmpty(stack); stack.Push("a"); stack.Push("b"); stack.Push("c"); Assert.IsFalse(stack.IsEmpty()); Assert.AreEqual("c", stack.Peek()); Assert.AreEqual("c", stack.Peek()); Assert.AreEqual("c", stack.Pop()); Assert.AreEqual("b", stack.Pop()); Assert.AreEqual("a", stack.Peek()); Assert.AreEqual("a", stack.Pop()); AssertEmpty(stack); }
private void AssertEmpty(Stack4 stack) { Assert.IsTrue(stack.IsEmpty()); Assert.IsNull(stack.Peek()); Assert.Expect(typeof(InvalidOperationException), new _ICodeBlock_35(stack)); }