예제 #1
0
        IEnumerable <IDev2Activity> ParseSwitch(FlowSwitch <string> switchFlowSwitch, List <IDev2Activity> seenActivities)
        {
            var activity = switchFlowSwitch.Expression as DsfFlowSwitchActivity;

            if (activity != null)
            {
                if (seenActivities.Contains(activity))
                {
                    return(new List <IDev2Activity> {
                        activity
                    });
                }

                var        val = new StringBuilder(Dev2DecisionStack.ExtractModelFromWorkflowPersistedData(activity.ExpressionText));
                Dev2Switch ds  = new Dev2Switch {
                    SwitchVariable = val.ToString()
                };
                var swi = new DsfSwitch(activity);
                if (!seenActivities.Contains(activity))
                {
                    seenActivities.Add(swi);
                }
                swi.Switches = switchFlowSwitch.Cases.Select(a => new Tuple <string, IDev2Activity>(a.Key, ParseTools(a.Value, seenActivities).FirstOrDefault())).ToDictionary(a => a.Item1, a => a.Item2);
                swi.Default  = ParseTools(switchFlowSwitch.Default, seenActivities);
                swi.Switch   = ds.SwitchVariable;


                return(new List <IDev2Activity>
                {
                    swi
                });
            }
            throw new Exception("Invalid activity");
        }
예제 #2
0
        public bool Equals(DsfSwitch other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var eq = base.Equals(other);

            eq &= string.Equals(Switch, other.Switch);
            eq &= string.Equals(Result, other.Result);
            eq &= string.Equals(OnErrorVariable, other.OnErrorVariable);
            eq &= string.Equals(OnErrorWorkflow, other.OnErrorWorkflow);
            eq &= IsEndedOnError == other.IsEndedOnError;

            return(eq);
        }
예제 #3
0
 public TestMockSwitchStep(DsfSwitch dsfSwitch)
     : base(dsfSwitch.DisplayName)
 {
     _dsfSwitch = dsfSwitch;
     UniqueID   = _dsfSwitch.UniqueID;
 }