public void TestPushPopCountArrayStackShouldWork() { ArrayStack<int> arrayStack = new ArrayStack<int>(); arrayStack.Push(15); int result = arrayStack.Pop(); Assert.AreEqual(0, arrayStack.Count); Assert.AreEqual(15, result); }
public void TestPushPopCountStringArrayStackShouldWork() { ArrayStack<string> arrayStack = new ArrayStack<string>(); arrayStack.Push("check"); for (int i = 0; i < 999; i++) { arrayStack.Push("error"); } for (int i = 0; i < 999; i++) { arrayStack.Pop(); } string result = arrayStack.Pop(); Assert.AreEqual(0, arrayStack.Count); Assert.AreEqual("check", result); }
public void CheckExeptionWhenPopFromEmptyArrayStack() { ArrayStack<string> arrayStack = new ArrayStack<string>(); arrayStack.Pop(); }
public void TestPushPopCountAssertWorkingCorrectly() { ArrayStack<int> arrayStack = new ArrayStack<int>(1); arrayStack.Push(1); Assert.AreEqual(1, arrayStack.Count); arrayStack.Push(2); Assert.AreEqual(2, arrayStack.Count); var result1 = arrayStack.Pop(); Assert.AreEqual(2, result1); Assert.AreEqual(1, arrayStack.Count); var result2 = arrayStack.Pop(); Assert.AreEqual(1, result2); Assert.AreEqual(0, arrayStack.Count); }