public void TestingPushAndPopTogether() { var stack = new StackKata <int>(); stack.Push(5); Assert.That(stack.Pop(), Is.EqualTo(5)); }
public void TestingPushOneElemet() { var stack = new StackKata <int>(); stack.Push(5); Assert.That(stack.Count, Is.EqualTo(1)); }
public void PopShouldRemoveLastPush() { var stack = new StackKata <int>(); stack.Push(7); stack.Push(9); stack.Push(1); Assert.That(stack.Pop(), Is.EqualTo(1)); Assert.That(stack.Count, Is.EqualTo(2)); }
public void TestPopOnly() { var expectedList = new List <int>(); expectedList.Add(5); expectedList.Add(7); expectedList.Add(9); expectedList.Add(1); var stack = new StackKata <int>(expectedList); Assert.That(stack.Pop(), Is.EqualTo(1)); Assert.That(stack.Pop(), Is.EqualTo(9)); Assert.That(stack.Pop(), Is.EqualTo(7)); Assert.That(stack.Pop(), Is.EqualTo(5)); }
public void TestPushOnly() { var expectedList = new List <int>(); expectedList.Add(5); expectedList.Add(7); expectedList.Add(9); expectedList.Add(1); var stack = new StackKata <int>(); stack.Push(5); stack.Push(7); stack.Push(9); stack.Push(1); Assert.That(stack.GetAsList(), Is.EqualTo(expectedList)); }
public void PoppingAnEmptyStackShouldThrowInvalidOperationException() { var stack = new StackKata <int>(); Assert.That(() => stack.Pop(), Throws.InvalidOperationException); }