public void Handle_Stack_Overflow() { var stack = new MyStack <int>(3); stack.Add(1); stack.Add(2); stack.Add(3); Assert.Throws <MyStackOverflowException>(() => stack.Add(4)); }
public void Get_Last_Element() { var stack = new MyStack <int>(3); stack.Add(1); stack.Add(2); int lastValue = stack.GetLastElement(); Assert.AreEqual(2, lastValue); }
public void Add_Remove() { MyStack <int> stack = new MyStack <int>(3); stack.Add(1); stack.Add(2); stack.Add(3); int removedValue = stack.Remove(); Assert.AreEqual(3, removedValue); Assert.AreEqual(2, stack.Size); }