public void Keep_Iterating_When_A_Posterior_Index_Is_Removed_On_Enter()
        {
            var stateBehaviour1 = Substitute.For <IStateBehaviour>();
            var stateBehaviour2 = Substitute.For <IStateBehaviour>();
            var stateBehaviour3 = Substitute.For <IStateBehaviour>();

            var state = new BehaviouralState(stateBehaviour1, stateBehaviour2, stateBehaviour3);

            stateBehaviour2.When(behaviour => behaviour.OnEnter())
            .Do(callbackInfo => state.RemoveBehaviour(stateBehaviour3));

            state.Enter();

            stateBehaviour1.Received(1).OnEnter();
            stateBehaviour2.Received(1).OnEnter();
            stateBehaviour3.DidNotReceive().OnEnter();
        }
Example #2
0
 protected override sealed void OnEnter()
 {
     _innerBehaviouralState.Enter();
 }