public void DoesPushAddElementWhenStackIsFull() { ArrayTypedStack stack = new ArrayTypedStack(2); stack.Push(2); stack.Push(3); stack.Push(4); }
public void DoesPopRemoveElementWhenStackIsNotEmpty() { ArrayTypedStack stack = new ArrayTypedStack(3); stack.Push(3); stack.Push(2); int actual = (int)stack.Pop(); int expected = 2; Assert.AreEqual(expected, actual); }
public void DoesPopDecreasedSize() { ArrayTypedStack stack = new ArrayTypedStack(3); stack.Push(3); stack.Push(2); stack.Pop(); int actual = stack.Size; int expected = 1; Assert.AreEqual(expected, actual); }
public void DoesDisplayElementsPrintsCorrectly() { ArrayTypedStack stack = new ArrayTypedStack(3); stack.Push(1); stack.Push(2); stack.Push(3); string expected = "3 2 1 "; string actual = stack.DisplayElements(); Assert.AreEqual(expected, actual); }
public void DoesPeekShowTopElementWhenStackIsNotEmpty() { ArrayTypedStack stack = new ArrayTypedStack(3); stack.Push(2); stack.Push(3); int actual = (int)stack.Peek(); int expected = 3; Assert.AreEqual(expected, actual); int actualSize = stack.Size; int expectedSize = 2; Assert.AreEqual(expectedSize, actualSize); }
public void DoesPushAddElementWhenStackIsNotEmpty() { ArrayTypedStack stack = new ArrayTypedStack(3); stack.Push(3); stack.Push(2); string actual = stack.DisplayElements(); string expected = "2 3 "; Assert.AreEqual(expected, actual); int actualSize = stack.Size; int expectedSize = 2; Assert.AreEqual(expectedSize, actualSize); }
public void DoesIsEmptyReturnFalseWhenStackIsNotEmpty() { ArrayTypedStack stack = new ArrayTypedStack(2); stack.Push(3); bool actualResult = stack.IsEmpty(); bool expectedResult = false; Assert.AreEqual(expectedResult, actualResult); }