public FlowBuilderTo(UiFlow uiFlow, CreatedInstances createdInstances, IState sourceState, IState targetState) { this.uiFlow = uiFlow; this.createdInstances = createdInstances; this.sourceState = sourceState; this.targetState = targetState; }
public void AddingTransitionAndStatesAddsEdge(UiFlow uiFlow, Transition transition) { uiFlow.AddStatesAndTransition(transition); var graph = uiFlow.ToGraph(); Assert.Equal(1, graph.Edges.Count()); }
public StartViaBuilder(UiFlow uiFlow, CreatedInstances createdInstances, IState state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } this.uiFlow = uiFlow; this.createdInstances = createdInstances; this.state = state; }
public void AddingStatesWithSameIdsAddsOnce(UiFlow uiFlow, Guid id) { var screenOne = new State(id, "State 1"); var screenTwo = new State(id, "State 2"); uiFlow.AddState(screenOne); uiFlow.AddState(screenTwo); var graph = uiFlow.ToGraph(); Assert.Equal(1, graph.Vertices.Count()); }
private Task <FCluster> BuildFlow(UiFlow flow) { var cluster = new FCluster(flow.FlowTypeId.ToUpper()); var contextData = flow.CurrentState.ContextData; var nodes = flow.ScreenConfigurations.Select(x => { var screenName = (ScreenName)x.ScreenName; var isCurrentStep = contextData.CurrentScreenStep.Equals(screenName); var alreadyExecuted = contextData.EventsLog.Any(e => e.FromStep.Equals(screenName)); FNode.FNodeColor color = isCurrentStep ? FNode.FNodeColor.Blue : alreadyExecuted ? FNode.FNodeColor.Green : FNode.FNodeColor.Gray; return(cluster.AddNode(new FNode(x.ScreenName, color) { Thickness = isCurrentStep ? 3 : alreadyExecuted ? 2 : 1 })); }).ToDictionary(x => x.Label, x => x); foreach (var step in flow.ScreenConfigurations) { var screenName = (ScreenName)step.ScreenName; var node = nodes[step.ScreenName]; foreach (var screenTransition in step.Transitions) { if (nodes.ContainsKey(screenTransition.DestinationScreen)) { var dest = nodes[screenTransition.DestinationScreen]; var edge = node.AddEdge(dest, screenTransition.DisplayName); var timesExecuted = contextData.EventsLog.Count(x => x.FromStep == screenName && x.ToStep == dest.Label && x.Event == (ScreenEvent)screenTransition.EventName); edge.Thickness = timesExecuted == 0 ? 1 : 3; const int maxDash = 7; edge.Dash = timesExecuted >= 1 ? (Math.Max(maxDash - timesExecuted, 0)).ToString() : maxDash.ToString(); edge.ToolTip = $"Times= {timesExecuted}"; } } } return(Task.FromResult(cluster)); }
private async Task <FCluster> AddContainerStep(UiFlow flow, FCluster flowCluster) { var result = flowCluster; if (flow.CurrentState.ContextData.IsInContainer()) { var containerFlow = await ResolveUiFlowFromHandler(flow.CurrentState.ContextData.ContainerFlowHandler); result = new FCluster( $"{containerFlow.FlowTypeId.ToUpper()}.{containerFlow.CurrentState.ContextData.CurrentScreenStep}"); result.AddNode(flowCluster); } return(result); }
public UiFlowBuilder() { this.uiFlow = new UiFlow(); this.createdInstances = new CreatedInstances(); }
public void AddingTransitionWithMissingStatesThrowsException(UiFlow uiFlow, Transition transition) { Assert.Throws <StateMissingException>(() => uiFlow.AddTransition(transition)); }
public FlowBuilder(UiFlow uiFlow, CreatedInstances createdInstances) { this.uiFlow = uiFlow; this.createdInstances = createdInstances; }
public FlowBuilderFrom(UiFlow uiFlow, CreatedInstances createdInstances, IState sourceState) { this.uiFlow = uiFlow; this.createdInstances = createdInstances; this.sourceState = sourceState; }