public void TestStateComponentInitialisation() { StateComponent <TestStates> actual = new StateComponent <TestStates>(TestStates.s1); TestStates expected = TestStates.s1; Assert.AreEqual(expected, actual.Peek(), "Test that the initialising state is the one passed in the constructor"); }
public void TestStateSwitch() { StateComponent <TestStates> actual = new StateComponent <TestStates>(TestStates.s1); actual.Switch(TestStates.s3); TestStates expected = TestStates.s3; Assert.AreEqual(expected, actual.Peek(), "Test that the state has changed once the stateis asked to switch"); }
public void TestStateComponentPush() { StateComponent <TestStates> actual = new StateComponent <TestStates>(TestStates.s1); actual.Push(TestStates.s2); TestStates expected = TestStates.s2; Assert.AreEqual(expected, actual.Peek(), "Test that the peeked state after a push is the topmost state"); }
public void TestStateComponentPop() { StateComponent <TestStates> actual = new StateComponent <TestStates>(TestStates.s1); actual.Push(TestStates.s2); actual.Pop(); TestStates expected = TestStates.s1; Assert.AreEqual(expected, actual.Peek(), "Test that the peeked state is the same after a push and pop"); }