public void Keep_Iterating_When_A_Previous_Index_Is_Removed_On_Exit() { 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.OnExit()) .Do(callbackInfo => state.RemoveBehaviour(stateBehaviour1)); state.Exit(); stateBehaviour1.Received(1).OnExit(); stateBehaviour2.Received(1).OnExit(); stateBehaviour3.Received(1).OnExit(); }
protected override sealed void OnExit() { _innerBehaviouralState.Exit(); }