public void testCreateStack() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(1); bool actual; // ACT actual = myStack.isEmpty(); // ASSERT Assert.True(actual); }
public void testIsEmptyTrue() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(1); bool actual, expected; // ACT actual = myStack.isEmpty(); expected = true; // ASSERT Assert.Equal(expected, actual); }
public void testIsEmptyFalse() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(1); string item = "Java is Fun!"; bool actual, expected; // ACT myStack.push(item); actual = myStack.isEmpty(); expected = false; // ASSERT Assert.Equal(expected, actual); }
public void testPushStack() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(2); string item = "StackItem"; string expected, actual; expected = "StackItem2"; // ACT myStack.push(item + "1"); myStack.push(item + "2"); actual = myStack.peek(); // ASSERT Assert.False(myStack.isEmpty()); Assert.Equal(expected, actual); }
public void testPrintStackUp() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(2); string item = "StackItem"; string actual, expected; expected = "StackItem1\nStackItem2\n"; // ACT myStack.push(item + "1"); myStack.push(item + "2"); actual = myStack.printStackUp(); // ASSERT Assert.Equal(expected, actual); Assert.False(myStack.isEmpty()); }
public void testPopStack() { // ARRANGE StackLabCode.stack myStack = new StackLabCode.stack(2); string item = "StackItem"; string actual1, actual2, expected1, expected2; expected1 = "StackItem2"; expected2 = "StackItem1"; myStack.push(item + "1"); myStack.push(item + "2"); // ACT actual1 = myStack.pop(); actual2 = myStack.pop(); // ASSERT Assert.Equal(expected1, actual1); Assert.Equal(expected2, actual2); Assert.True(myStack.isEmpty()); }