コード例 #1
0
        public void SetState_AnyState_ShouldActivateDeactivate()
        {
            // Arrange
            bool deactivateCalled = false;
            bool activateCalled   = false;

            InitializeStateController();
            Mock.Arrange(() => _placidState.Deactivate()).DoInstead(() => { deactivateCalled = true; });
            Mock.Arrange(() => _hostileState.Activate()).DoInstead(() => { activateCalled = true; });

            // Act
            _stateControllerInternal.SetState(_stateController.GetHostileState());

            // Assert
            Assert.True(deactivateCalled);
            Assert.True(activateCalled);
        }
コード例 #2
0
 public void Die()
 {
     _stateController.SetState(_stateController.GetDeadState());
 }