public void SelectAndApplyActivity_SetupExecute_GivenNumberFormatTool_ToCorrectFormat() { var activity = new DsfNumberFormatActivity { Expression = "[[result]]", Result = "[[result]]", RoundingType = Dev2EnumConverter.ConvertEnumValueToString(enRoundingType.Up), RoundingDecimalPlaces = "2", DecimalPlacesToShow = "2" }; //------------Setup for test-------------------------- SetupArgumentsForFormatNumber("", "", activity); //------------Execute Test--------------------------- ExecuteProcess(DataObject); //------------Assert Results------------------------- var ages = DataObject.Environment.EvalAsListOfStrings("[[Person(*).Age]]", 0); Assert.AreEqual("5.27", ages[0]); Assert.AreEqual("2.30", ages[1]); Assert.AreEqual("1.00", ages[2]); Assert.AreEqual("-3.46", ages[3]); Assert.AreEqual("0.88", ages[4]); }
public RandomDesignerViewModel(ModelItem modelItem) : base(modelItem) { AddTitleBarHelpToggle(); RandomTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enRandomType>(); SelectedRandomType = Dev2EnumConverter.ConvertEnumValueToString(RandomType); }
public ForeachDesignerViewModel(ModelItem modelItem) : base(modelItem) { AddTitleBarHelpToggle(); ForeachTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enForEachType>(); SelectedForeachType = Dev2EnumConverter.ConvertEnumValueToString(ForEachType); }
public ScriptDesignerViewModel(ModelItem modelItem) : base(modelItem) { AddTitleBarHelpToggle(); ScriptTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enScriptType>(); SelectedScriptType = Dev2EnumConverter.ConvertEnumValueToString(ScriptType); }
public RandomDesignerViewModel(ModelItem modelItem) : base(modelItem) { RandomTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enRandomType>(); SelectedRandomType = Dev2EnumConverter.ConvertEnumValueToString(RandomType); AddTitleBarLargeToggle(); HelpText = Warewolf.Studio.Resources.Languages.HelpText.Tool_Utility_Random; }
public ForeachDesignerViewModel(ModelItem modelItem) : base(modelItem) { ForeachTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enForEachType>(); SelectedForeachType = Dev2EnumConverter.ConvertEnumValueToString(ForEachType); AddTitleBarLargeToggle(); HelpText = Warewolf.Studio.Resources.Languages.HelpText.Tool_LoopConstruct_For_Each; }
public FormatNumberTO(string number, enRoundingType roundingType, int roundingDecimalPlaces, bool adjustDecimalPlaces, int decimalPlacesToShow) { Number = "'" + number + "'"; RoundingType = Dev2EnumConverter.ConvertEnumValueToString(roundingType); RoundingDecimalPlaces = roundingDecimalPlaces; AdjustDecimalPlaces = adjustDecimalPlaces; DecimalPlacesToShow = decimalPlacesToShow; }
public ScriptDesignerViewModel(ModelItem modelItem) : base(modelItem) { _eventPublisher = EventPublishers.Aggregator; _eventPublisher.Subscribe(this); EscapeScript = true; ScriptTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enScriptType>(); SelectedScriptType = Dev2EnumConverter.ConvertEnumValueToString(ScriptType); ChooseScriptSourceCommand = new DelegateCommand(o => ChooseScriptSources()); AddTitleBarLargeToggle(); HelpText = Warewolf.Studio.Resources.Languages.HelpText.Tool_Scripting_Script; }
public void SelectAndApplyActivity_SetupExecute_GivenNumberFormatTool_ToCorrectFormat_ComplexObjects() { var activity = new DsfNumberFormatActivity { Expression = "[[result]]", Result = "[[result]]", RoundingType = Dev2EnumConverter.ConvertEnumValueToString(enRoundingType.Up), RoundingDecimalPlaces = "2", DecimalPlacesToShow = "2" }; //------------Setup for test-------------------------- //SetupArgumentsForFormatNumber("", "", activity); DataObject.Environment = new ExecutionEnvironment(); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "5.2687454"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "2.3"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "1"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "-3.4554"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "0.875768"), 0); const string dataSource = "[[@Person(*).Age]]"; const string alias = "[[result]]"; DsfSelectAndApplyActivity dsfSelectAndApplyActivity = new DsfSelectAndApplyActivity { DataSource = dataSource, Alias = alias, //ApplyActivity = activity }; dsfSelectAndApplyActivity.ApplyActivityFunc.Handler = activity; TestStartNode = new FlowStep { Action = dsfSelectAndApplyActivity }; CurrentDl = string.Empty; TestData = string.Empty; //------------Execute Test--------------------------- ExecuteProcess(DataObject); //------------Assert Results------------------------- var ages = DataObject.Environment.EvalAsListOfStrings("[[@Person(*).Age]]", 0); Assert.AreEqual("5.27", ages[0]); Assert.AreEqual("2.30", ages[1]); Assert.AreEqual("1.00", ages[2]); Assert.AreEqual("-3.46", ages[3]); Assert.AreEqual("0.88", ages[4]); }
public ForeachDesignerViewModel(ModelItem modelItem) : base(modelItem) { ForeachTypes = Dev2EnumConverter.ConvertEnumsTypeToStringList <enForEachType>(); SelectedForeachType = Dev2EnumConverter.ConvertEnumValueToString(ForEachType); AddTitleBarLargeToggle(); HelpText = Warewolf.Studio.Resources.Languages.HelpText.Tool_LoopConstruct_For_Each; var dataFunc = modelItem.Properties["DataFunc"]?.ComputedValue as ActivityFunc <string, bool>; DataFuncDisplayName = dataFunc?.Handler == null ? "" : dataFunc?.Handler?.DisplayName; var type = dataFunc?.Handler?.GetType(); if (type != null) { DataFuncIcon = ModelItemUtils.GetImageSourceForToolFromType(type); } }
//SetupArguments(ActivityStrings.NumberFormatActivity_DataList_WithData, ActivityStrings.NumberFormatActivity_DataList_Shape, // "[[resRecordSet().number]]", "[[recordSet(*).number]]", enRoundingType.Normal, "", ""); private void SetupArguments(string currentDl, string testData, string result, string expression, enRoundingType roundingType, string roundingDecimalPlaces, string decimalPlacesToShow) { TestStartNode = new FlowStep { Action = new DsfNumberFormatActivity { Expression = expression, Result = result, RoundingType = Dev2EnumConverter.ConvertEnumValueToString(roundingType), RoundingDecimalPlaces = roundingDecimalPlaces, DecimalPlacesToShow = decimalPlacesToShow, } }; CurrentDl = testData; TestData = currentDl; }
public void SelectAndApplyActivity_SetupExecute_GivenNumberFormatTool_ToDifferentResult() { var activity = new DsfNumberFormatActivity { Expression = "[[result]]", Result = "[[b]]", RoundingType = Dev2EnumConverter.ConvertEnumValueToString(enRoundingType.Up), RoundingDecimalPlaces = "2", DecimalPlacesToShow = "2" }; //------------Setup for test-------------------------- SetupArgumentsForFormatNumber("", "", activity); //------------Execute Test--------------------------- ExecuteProcess(DataObject); //------------Assert Results------------------------- var ages = DataObject.Environment.EvalAsListOfStrings("[[Person(*).Age]]", 0); var evalAsList = DataObject.Environment.EvalAsList("[[b]]", 1); }
public void SelectAndApplyActivity_SetupExecute_GivenNullDataSource_DataObjectsHasCorrectErrors() { var activity = new DsfNumberFormatActivity { Expression = "[[result]]", Result = "[[result]]", RoundingType = Dev2EnumConverter.ConvertEnumValueToString(enRoundingType.Up), RoundingDecimalPlaces = "2", DecimalPlacesToShow = "2" }; //------------Setup for test-------------------------- //SetupArgumentsForFormatNumber("", "", activity); DataObject.Environment = new ExecutionEnvironment(); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "5.2687454"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "2.3"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "1"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "-3.4554"), 0); DataObject.Environment.AssignJson(new AssignValue("[[@Person().Age]]", "0.875768"), 0); DsfSelectAndApplyActivity dsfSelectAndApplyActivity = new DsfSelectAndApplyActivity(); dsfSelectAndApplyActivity.ApplyActivityFunc.Handler = activity; TestStartNode = new FlowStep { Action = dsfSelectAndApplyActivity }; CurrentDl = string.Empty; TestData = string.Empty; //------------Execute Test--------------------------- ExecuteProcess(DataObject); //------------Assert Results------------------------- var errors = DataObject.Environment.Errors; Assert.AreEqual(2, errors.Count); Assert.IsTrue(errors.Contains(ErrorResource.DataSourceEmpty)); Assert.IsTrue(errors.Contains(string.Format(ErrorResource.CanNotBeEmpty, "Alias"))); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(Dev2EnumConverter.ConvertEnumValueToString(value as Enum)); }