예제 #1
0
        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");
        }
예제 #2
0
        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");
        }
예제 #3
0
        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");
        }
예제 #4
0
        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");
        }