Exemplo n.º 1
0
        public void GivenItContainsDateAndTimeAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfDateTimeActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var input1             = tableRow["Input"];
                var outputFormat       = tableRow["Output Format"];
                var inputFormat        = tableRow["Input Format"];
                var timeModifierAmount = tableRow["Add Time"];
                var result             = tableRow["Result"];

                CommonSteps.AddVariableToVariableList(result);

                activity.DateTime     = input1;
                activity.InputFormat  = inputFormat;
                activity.OutputFormat = outputFormat;
                activity.TimeModifierAmountDisplay = timeModifierAmount;
                activity.TimeModifierType          = "Years";
                activity.Result = result;
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 2
0
        public void GivenContainsAnAssignAs(string parentName, string assignName, Table table)
        {
            DsfMultiAssignActivity assignActivity = new DsfMultiAssignActivity {
                DisplayName = assignName
            };

            foreach (var tableRow in table.Rows)
            {
                var value    = tableRow["value"];
                var variable = tableRow["variable"];

                value = value.Replace('"', ' ').Trim();

                if (value.StartsWith("="))
                {
                    value = value.Replace("=", "");
                    value = string.Format("!~calculation~!{0}!~~calculation~!", value);
                }

                List <ActivityDTO> fieldCollection;
                ScenarioContext.Current.TryGetValue("fieldCollection", out fieldCollection);

                CommonSteps.AddVariableToVariableList(variable);

                assignActivity.FieldsCollection.Add(new ActivityDTO(variable, value, 1, true));
            }
            CommonSteps.AddActivityToActivityList(parentName, assignName, assignActivity);
        }
Exemplo n.º 3
0
        public void GivenItContainsDateAndTimeDifferenceAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfDateTimeDifferenceActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var input1      = tableRow["Input1"];
                var input2      = tableRow["Input2"];
                var inputFormat = tableRow["Input Format"];
                var output      = tableRow["Output In"];
                var result      = tableRow["Result"];

                CommonSteps.AddVariableToVariableList(result);

                activity.Input1      = input1;
                activity.Input2      = input2;
                activity.InputFormat = inputFormat;
                activity.OutputType  = output;
                activity.Result      = result;
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 4
0
        public void GivenItContainsDataSplitAs(string parentName, string activityName, Table table)
        {
            DsfDataSplitActivity activity = new DsfDataSplitActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var valueToSplit = string.IsNullOrEmpty(tableRow["String"]) ? "" : tableRow["String"];
                var variable     = tableRow["Variable"];
                var type         = tableRow["Type"];
                var at           = tableRow["At"];
                var include      = tableRow["Include"] == "Selected";
                //var escapeChar = tableRow["Escape"];
                CommonSteps.AddVariableToVariableList(variable);
                if (!string.IsNullOrEmpty(valueToSplit))
                {
                    activity.SourceString = valueToSplit;
                }
                CommonSteps.AddVariableToVariableList(variable);
                activity.ResultsCollection.Add(new DataSplitDTO(variable, type, at, 1, include, true));
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 5
0
        public void GivenItContainsFormatNumberAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfNumberFormatActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var number              = tableRow["Number"];
                var roundTo             = tableRow["Rounding To"];
                var roundingType        = tableRow["Rounding Selected"];
                var decimalPlacesToShow = tableRow["Decimal to show"];
                var result              = tableRow["Result"];

                CommonSteps.AddVariableToVariableList(result);

                activity.Expression            = number;
                activity.RoundingType          = roundingType;
                activity.RoundingDecimalPlaces = roundTo;
                activity.DecimalPlacesToShow   = decimalPlacesToShow;
                activity.Result = result;
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 6
0
        public void GivenCalculateWithFormulaInto(string parentName, string activityName, string formula, string resultVariable)
        {
            CommonSteps.AddVariableToVariableList(resultVariable);

            DsfCalculateActivity calculateActivity = new DsfCalculateActivity {
                Expression = formula, Result = resultVariable, DisplayName = activityName
            };

            CommonSteps.AddActivityToActivityList(parentName, activityName, calculateActivity);
        }
Exemplo n.º 7
0
        public void GivenCountOnInto(string parentName, string activityName, string recordSet, string result)
        {
            CommonSteps.AddVariableToVariableList(result);

            DsfCountRecordsetActivity countRecordsetActivity = new DsfCountRecordsetActivity {
                CountNumber = result, RecordsetName = recordSet, DisplayName = activityName
            };

            CommonSteps.AddActivityToActivityList(parentName, activityName, countRecordsetActivity);
        }
Exemplo n.º 8
0
        public void GivenItContainsGatherSystemInfoAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfGatherSystemInformationActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable = tableRow["Variable"];

                CommonSteps.AddVariableToVariableList(variable);

                enTypeOfSystemInformationToGather systemInfo = (enTypeOfSystemInformationToGather)Dev2EnumConverter.GetEnumFromStringDiscription(tableRow["Selected"], typeof(enTypeOfSystemInformationToGather));
                activity.SystemInformationCollection.Add(new GatherSystemInformationTO(systemInfo, variable, 1));
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 9
0
        public void GivenItContainsDeleteAs(string parentName, string activityName, Table table)
        {
            DsfDeleteRecordActivity activity = new DsfDeleteRecordActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var result   = tableRow["result"];
                var variable = tableRow["Variable"];

                CommonSteps.AddVariableToVariableList(result);
                activity.RecordsetName = variable;
                activity.Result        = result;
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 10
0
        public void GivenItContainsDataMergeAs(string parentName, string activityName, string resultVariable, Table table)
        {
            DsfDataMergeActivity activity = new DsfDataMergeActivity {
                Result = resultVariable, DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable  = tableRow["Variable"];
                var type      = tableRow["Type"];
                var at        = tableRow["Using"];
                var padding   = tableRow["Padding"];
                var alignment = tableRow["Alignment"];

                activity.MergeCollection.Add(new DataMergeDTO(variable, type, at, 1, padding, alignment, true));
            }
            CommonSteps.AddVariableToVariableList(resultVariable);
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 11
0
        public void GivenItContainsReplaceIntoAs(string parentName, string activityName, string resultVariable, Table table)
        {
            DsfReplaceActivity activity = new DsfReplaceActivity {
                Result = resultVariable, DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable     = tableRow["In Fields"];
                var find         = tableRow["Find"];
                var replaceValue = tableRow["Replace With"];

                activity.FieldsToSearch = variable;
                activity.Find           = find;
                activity.ReplaceWith    = replaceValue;
            }
            CommonSteps.AddVariableToVariableList(resultVariable);
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 12
0
        public void GivenItContainFindUniqueAs(string parentName, string activityName, Table table)
        {
            DsfUniqueActivity activity = new DsfUniqueActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var inFields     = tableRow["In Fields"];
                var returnFields = tableRow["Return Fields"];
                var result       = tableRow["Result"];

                activity.InFields     = inFields;
                activity.ResultFields = returnFields;
                activity.Result       = result;

                CommonSteps.AddVariableToVariableList(result);
            }
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 13
0
        public void GivenItContainsFindRecordIndexSearchAndResultAs(string parentName, string activityName, string recsetToSearch, string resultVariable, Table table)
        {
            var result = resultVariable;
            var recset = recsetToSearch;

            CommonSteps.AddVariableToVariableList(result);
            DsfFindRecordsMultipleCriteriaActivity activity = new DsfFindRecordsMultipleCriteriaActivity {
                RequireAllFieldsToMatch = false, RequireAllTrue = false, Result = result, FieldsToSearch = recset, DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var matchType  = tableRow["Match Type"];
                var matchValue = tableRow["Match"];

                activity.ResultsCollection.Add(new FindRecordsTO(matchValue, matchType, 1, true));
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 14
0
        public void GivenItContainsFindIndexIntoAs(string parentName, string activityName, string resultVariable, Table table)
        {
            DsfIndexActivity activity = new DsfIndexActivity {
                Result = resultVariable, DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable  = tableRow["In Fields"];
                var index     = tableRow["Index"];
                var character = tableRow["Character"];
                var direction = tableRow["Direction"];

                activity.InField    = variable;
                activity.Index      = index;
                activity.Characters = character;
                activity.Direction  = direction;
            }
            CommonSteps.AddVariableToVariableList(resultVariable);
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 15
0
        public void GivenContainsAnDeleteFolderAs(string parentName, string activityName, Table table)
        {
            DsfPathDelete activity = new DsfPathDelete {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable = tableRow["Recordset"];
                //var userName = tableRow["Username"];
                //var password = tableRow["Password"];
                var result = tableRow["Result"];

                activity.Result    = result;
                activity.InputPath = variable;
                //activity.Username = userName;
                //activity.Password = password;

                CommonSteps.AddVariableToVariableList(result);
            }
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 16
0
        public void GivenItContainsRandomAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfRandomActivity {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var type   = (enRandomType)Enum.Parse(typeof(enRandomType), tableRow["Type"]);
                var from   = tableRow["From"];
                var to     = tableRow["To"];
                var result = tableRow["Result"];

                CommonSteps.AddVariableToVariableList(result);

                activity.RandomType = type;
                activity.To         = to;
                activity.From       = from;
                activity.Result     = result;
            }

            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Exemplo n.º 17
0
        public void GivenContainsAnCreateAs(string parentName, string activityName, Table table)
        {
            DsfPathCreate activity = new DsfPathCreate {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable = tableRow["File or Folder"];
                var exist    = tableRow["If it exits"];
                var userName = tableRow["Username"];
                var password = tableRow["Password"];
                var result   = tableRow["Result"];

                activity.Result     = result;
                activity.Username   = userName;
                activity.Password   = password;
                activity.Overwrite  = exist == "True";
                activity.OutputPath = variable;

                CommonSteps.AddVariableToVariableList(result);
            }
            CommonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }