public void Keep_Iterating_When_A_Posterior_Index_Is_Removed_On_Update()
        {
            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.OnUpdate())
            .Do(callbackInfo => state.RemoveBehaviour(stateBehaviour3));

            state.Update();

            stateBehaviour1.Received(1).OnUpdate();
            stateBehaviour2.Received(1).OnUpdate();
            stateBehaviour3.DidNotReceive().OnUpdate();
        }
Beispiel #2
0
 protected override sealed void OnUpdate()
 {
     _innerBehaviouralState.Update();
 }