public async Task ExecuteReentryActionAsync_executes_ReentryAction() { var sale = new Sale(saleID: 96) { State = SaleState.Open }; var transitionResult = new StateTransitionResult <SaleState, SaleEvent>(SaleEvent.AddItem , SaleState.Open , SaleState.Open , SaleState.Open , "lastTransitionName"); var stateMachine = new StateMachineAsync <Sale, SaleState, SaleEvent>(sale1 => sale1.State, (sale1, newState) => sale1.State = newState); var openState = new StateConfigurationAsync <Sale, SaleState, SaleEvent>(SaleState.Open, stateMachine); var changeDueState = new StateConfigurationAsync <Sale, SaleState, SaleEvent>(SaleState.ChangeDue, stateMachine); changeDueState.AddSuperstate(openState); var changeDueEntryActionFromOpenFired = false; changeDueState.AddReentryAction((sale1, _) => { changeDueEntryActionFromOpenFired = true; return(Task.CompletedTask); }); var parameters = new ExecutionParameters <Sale, SaleEvent>(SaleEvent.Pay, sale); await changeDueState.ExecuteReentryActionAsync(parameters, transitionResult); Assert.True(changeDueEntryActionFromOpenFired); }