public async Task FailureStateFlowTest() { IStateManager workPlan = new StateManagerBuilder() .Add(new StateItemFailure()) .Build(); StateContext stateContext = await workPlan.RunAsync(_workContext); stateContext.Should().NotBeNull(); const int count = 0; stateContext.WorkItemIndex.Should().Be(count); workPlan.IsRunning.Should().BeFalse(); workPlan.StateItems.Count.Should().Be(1); workPlan.IsSuccessful.Should().BeFalse(); }
public async Task SimpleNotifyTest() { bool pass = false; IStateManager workPlan = new StateManagerBuilder() .Add(new StateItemSuccess()) .Set(o => o.If(x => x.ActionType == StateNotify.ActionTypes.Set, x => pass = true, x => pass = false)) .Build(); StateContext stateContext = await workPlan.RunAsync(_workContext); stateContext.Should().NotBeNull(); const int count = 1; stateContext.WorkItemIndex.Should().Be(count); pass.Should().BeTrue(); }