public void givenState_whenAddingToStateManager_addStateCorrectly() { IState stateToAdd = new StateStub(); _stateManager.AddState((int)States.Meow, stateToAdd); Assert.AreEqual(stateToAdd, _stateManager.GetState((int)States.Meow)); }
public void givenState_whenSettingToCurrentState_setCurrentStateCorrectly() { IState stateToAdd = new StateStub(); _stateManager.AddState((int)States.Meow, stateToAdd); _stateManager.SetCurrentState((int)States.Meow); Assert.AreEqual(stateToAdd, _stateManager.GetCurrentState()); }
public void givenTwoStatesThatHaveATransition_whenChangingToState_updateCurrentStateCorrectlyAndCallOnEnterCorrectly() { StateStub stateOne = new StateStub(); StateStub stateTwo = new StateStub(); _stateManager.AddState((int)States.Meow, stateOne); _stateManager.AddState((int)States.Woof, stateTwo); _stateManager.AddTransition((int)States.Meow, (int)States.Woof); _stateManager.SetCurrentState((int)States.Meow); _stateManager.ChangeToState((int)States.Woof); Assert.AreEqual(stateTwo, _stateManager.GetCurrentState()); Assert.IsTrue(stateTwo.HasEntered); }