protected override void ConfigureDefinition(FlowDefinition <MockedDecisionFlowRequest, MockedDecisionFlowResponse> flowDefinition) { var intValue = FlowValueDecision <int?> .NewDefinition() .BindInput(rq => rq.SwitchValue, nameof(MockedDecisionFlowRequest.IntValue)); var setOutputToX = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "X") .BindOutput(rs => rs.Output, nameof(MockedDecisionFlowResponse.BranchValue)); var setOutputToY = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "Y") .BindOutput(rs => rs.Output, nameof(MockedDecisionFlowResponse.BranchValue)); var setOutputToZ = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "Z") .BindOutput(rs => rs.Output, nameof(MockedDecisionFlowResponse.BranchValue)); flowDefinition .Check("Int_value", intValue) .When(1).Goto("Set_output_to_X") .When(2).Goto("Set_output_to_Y") .Else().Goto("Set_output_to_Z") .Do("Set_output_to_X", setOutputToX) .End() .Do("Set_output_to_Y", setOutputToY) .End() .Do("Set_output_to_Z", setOutputToZ) .End(); }
protected override void ConfigureDefinition(FlowDefinition <SubPropertyBindingsFlowRequest, SubPropertyBindingsFlowResponse> flowDefinition) { flowDefinition .Check("Decision_1", FlowValueDecision <int?> .NewDefinition() .BindInput(rq => rq.SwitchValue, "StringValue1", (string s) => s.Length)) .When(0).End() .Else().Continue() .Check("Decision_2", FlowValueDecision <int?> .NewDefinition() .BindInput(rq => rq.SwitchValue, "StringValue2", (string s) => s.Length)) .When(0).End() .Else().Continue() .Do("Activity_1", new FlowActivityDefinition <SubPropertyBindingsActivityRequest, SubPropertyBindingsActivityResponse>() .BindInput(rq => rq.IntValue, "StringValue1", (string s) => s.Length) .BindOutput(rs => rs.IntValue, "StringValue1", i => i.ToString())) .Do("Activity_2", new FlowActivityDefinition <SubPropertyBindingsActivityRequest, SubPropertyBindingsActivityResponse>() .BindInput(rq => rq.IntValue, "StringValue2", (string s) => s.Length) .BindOutput(rs => rs.IntValue, "StringValue2", i => i.ToString())); }
protected override void ConfigureDefinition(FlowDefinition <TestElseThrowRequest, TestElseThrowResponse> flowDefinition) { flowDefinition .Check("UnhandledDecisionName", NullableFlowValueDecision <string> .NewDefinition() .BindInput(rq => rq.SwitchValue, nameof(TestElseThrowRequest.Input))) .When((string)null).End() .Else().Unhandled(); }
protected override void ConfigureDefinition(FlowDefinition <MatchDecisionFlowRequest, MatchDecisionFlowResponse> flowDefinition) { #region Definitions var intValueDecision = FlowValueDecision <int?> .NewDefinition() .BindInput(rq => rq.SwitchValue, nameof(MatchDecisionFlowRequest.IntValue)); var stringValueDecision = FlowValueDecision <string> .NewDefinition() .BindInput(rq => rq.SwitchValue, nameof(MatchDecisionFlowRequest.StringValue)); var setOutputToX = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "X") .BindOutput(rs => rs.Output, nameof(MatchDecisionFlowResponse.BranchValue)); var setOutputToY = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "Y") .BindOutput(rs => rs.Output, nameof(MatchDecisionFlowResponse.BranchValue)); var setOutputToZa = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "ZA") .BindOutput(rs => rs.Output, nameof(MatchDecisionFlowResponse.BranchValue)); var setOutputToZz = new FlowActivityDefinition <SetStringFlowValueRequest, SetStringFlowValueResponse>() .SetValue(rq => rq.OutputValue, "ZZ") .BindOutput(rs => rs.Output, nameof(MatchDecisionFlowResponse.BranchValue)); #endregion flowDefinition .Check("Int_value", intValueDecision) .When(1).Goto("Set_output_to_X") .When(2, 3).Goto("Set_output_to_Y") .Else().Goto("String_value") .Do("Set_output_to_X", setOutputToX) .End() .Do("Set_output_to_Y", setOutputToY) .End() .Check("String_value", stringValueDecision) .When("A").Goto("Set_output_to_ZA") .Else().Continue() .Do("Set_output_to_ZZ", setOutputToZz) .End() .Do("Set_output_to_ZA", setOutputToZa); }
protected override void ConfigureDefinition(FlowDefinition <TestDecisionDictionaryBindingRequest, TestDecisionDictionaryBindingResponse> flowDefinition) { flowDefinition .Check("Decision", new FlowDecisionDefinition <DictionaryBindingDecisionRequest, int>() .BindInputs(rq => rq.Strings, new FlowValueTypeSelector(typeof(string))) .BindInputs(rq => rq.NamedStrings, "String2") .BindInputs(rq => rq.StringLengths, new FlowValueRegexSelector(".*String.*", n => n + ".Length"), (string v) => v.Length) .BindInputs(rq => rq.RenamedStrings, new Dictionary <string, string> { { "String1", "RenamedString1" }, { "String2", "RenamedString2" }, }) ) .Else().Continue(); }
protected override void ConfigureDefinition(FlowDefinition <MultipleMatchDecisionFlowRequest, MultipleMatchDecisionFlowResponse> flowDefinition) { #region Definitions var intValueDecision = FlowValueDecision <int?> .NewDefinition() .BindInput(rq => rq.SwitchValue, nameof(MatchDecisionFlowRequest.IntValue)); #endregion flowDefinition .Check("Int_value", intValueDecision) .When(1).End() .When(1, 2, 3).End() .Else().End(); }
protected override void ConfigureDefinition(FlowDefinition <DecisionBindingAttributesFlowRequest, DecisionBindingAttributesFlowResponse> flowDefinition) { var isDecisionValueTrue = new FlowDecisionDefinition <BindingAttributesDecision, bool>() .SetValue(r => r.DecisionInput1Name, nameof(DecisionBindingAttributesFlowRequest.FlowInput1)) .SetValue(r => r.NamedDecisionInputName, nameof(DecisionBindingAttributesFlowRequest.FlowInput2)); var setFlowOutputToFalse = new FlowActivityDefinition <SetBoolFlowValueRequest, SetBoolFlowValueResponse>() .SetValue(r => r.OutputValue, false) .BindOutput(r => r.Output, nameof(DecisionBindingAttributesFlowResponse.FlowOutput)); var setFlowOutputToTrue = new FlowActivityDefinition <SetBoolFlowValueRequest, SetBoolFlowValueResponse>() .SetValue(r => r.OutputValue, true) .BindOutput(r => r.Output, nameof(DecisionBindingAttributesFlowResponse.FlowOutput)); flowDefinition .Check("Is_decision_value_true", isDecisionValueTrue) .When(true).Goto("Set_flow_output_to_true") .Else().Continue() .Do("Set_flow_output_to_false", setFlowOutputToFalse) .End() .Do("Set_flow_output_to_true", setFlowOutputToTrue); }