public void AddDynamicTransitionWRequest_throws_ArgumentNullException_if_Function_null() { var stateMachine = new StateMachineAsync <Sale, SaleState, SaleEvent>(sale => sale.State, (sale, newState) => sale.State = newState); var sut = new StateConfigurationAsync <Sale, SaleState, SaleEvent>(SaleState.ChangeDue, stateMachine); Assert.Throws <ArgumentNullException>(() => sut.AddDynamicTransition <string>(SaleEvent.AddItem, stateFunction: null)); }
public void AddDynamicTransitionWRequest_adds_transition() { var stateMachine = new StateMachineAsync <Sale, SaleState, SaleEvent>(sale => sale.State, (sale, newState) => sale.State = newState); var sut = new StateConfigurationAsync <Sale, SaleState, SaleEvent>(SaleState.ChangeDue, stateMachine); sut.AddDynamicTransition <string>(SaleEvent.AddItem, stateFunction: (sale, request) => SaleState.Complete); Assert.Single(sut.Transitions); }