public ActSetVariableValuePage(ActSetVariableValue act) { InitializeComponent(); mAct = act; SetComboListsValues(); App.ObjFieldBinding(VariableNameComboBox, ComboBox.TextProperty, mAct, "VariableName"); }
private void publishValueToLinkedBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(mVariable.LinkedVariableName) == false) { try { ActSetVariableValue setValueAct = new ActSetVariableValue(); setValueAct.VariableName = mVariable.LinkedVariableName; setValueAct.SetVariableValueOption = ActSetVariableValue.eSetValueOptions.SetValue; setValueAct.Value = mVariable.Value; setValueAct.RunOnBusinessFlow = App.BusinessFlow; setValueAct.Execute(); if (string.IsNullOrEmpty(setValueAct.Error) == false) { Reporter.ToUser(eUserMsgKeys.StaticErrorMessage, "Failed to publish the value to linked variable.." + System.Environment.NewLine + System.Environment.NewLine + "Error: " + setValueAct.Error); } } catch (Exception ex) { Reporter.ToUser(eUserMsgKeys.StaticErrorMessage, "Failed to publish the value to linked variable." + System.Environment.NewLine + System.Environment.NewLine + "Error: " + ex.Message); } } else { Reporter.ToUser(eUserMsgKeys.StaticWarnMessage, "Missing linked variable, please configure."); } }
public ActSetVariableValuePage(ActSetVariableValue act) { InitializeComponent(); mAct = act; SetComboListsValues(); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(VariableNameComboBox, ComboBox.TextProperty, mAct, "VariableName"); }
public ActSetVariableValuePage(ActSetVariableValue act) { InitializeComponent(); mAct = act; if (mAct.Context != null) { mContext = Context.GetAsContext(mAct.Context); } SetComboListsValues(); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(VariableNameComboBox, ComboBox.TextProperty, mAct, "VariableName"); }
public void TestVariable_RandomNumberSetValue() { //Arrange int min = 1; int max = 5; string variableName = "V1"; ResetBusinessFlow(); Activity activity1 = new Activity() { Active = true }; mBF.Activities.Add(activity1); VariableRandomNumber v1 = new VariableRandomNumber() { Name = variableName, Interval = 1, Min = min, Max = max }; activity1.AddVariable(v1); ActSetVariableValue actSetVariableValue = new ActSetVariableValue() { VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.AutoGenerateValue, Active = true }; activity1.Acts.Add(actSetVariableValue); //Act mGR.RunRunner(); //Assert decimal num1 = decimal.Parse(v1.Value); Assert.AreEqual(eRunStatus.Passed, mBF.RunStatus); Assert.AreEqual(eRunStatus.Passed, activity1.Status); Assert.IsTrue(num1 >= min && num1 <= max, "num1 >= " + min + " && num1 <= " + max); }
public void TestVariable_StringClearSpecialChar() { //Arrange string initialValue = "S$tr!ing@123#"; string variableName = "V1"; string specialCharacters = "$@#!"; string expectedValue = RemoveSpecialCharacters(initialValue, specialCharacters.ToCharArray()); ResetBusinessFlow(); Activity activity1 = new Activity() { Active = true }; mBF.Activities.Add(activity1); VariableString v1 = new VariableString() { Name = variableName, InitialStringValue = initialValue }; activity1.AddVariable(v1); ActSetVariableValue actSetVariableValue = new ActSetVariableValue() { VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.ClearSpecialChar, Active = true, Value = specialCharacters }; activity1.Acts.Add(actSetVariableValue); //Act mGR.RunRunner(); //Assert Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed); Assert.AreEqual(activity1.Status, eRunStatus.Passed); Assert.AreEqual(expectedValue, mBF.Activities[0].Variables[0].Value); Assert.AreEqual(expectedValue, v1.Value); }
public void TestVariable_StringSetValue() { //Arrange string initialValue = "123"; string variableName = "V1"; string newValue = "abc"; ResetBusinessFlow(); Activity activity1 = new Activity() { Active = true }; mBF.Activities.Add(activity1); VariableString v1 = new VariableString() { Name = variableName, InitialStringValue = initialValue }; activity1.AddVariable(v1); ActSetVariableValue actSetVariableValue = new ActSetVariableValue() { VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.SetValue, Value = newValue, Active = true }; activity1.Acts.Add(actSetVariableValue); //Act mGR.RunRunner(); //Assert Assert.AreEqual(eRunStatus.Passed, actSetVariableValue.Status); Assert.AreEqual(eRunStatus.Passed, mBF.RunStatus); Assert.AreEqual(eRunStatus.Passed, activity1.Status); Assert.AreEqual(newValue, v1.Value); }
public void TestVariable_SelectionListSetValue() { //Arrange string variableName = "V1"; ResetBusinessFlow(); Activity activity1 = new Activity() { Active = true }; mBF.Activities.Add(activity1); VariableSelectionList v1 = new VariableSelectionList() { Name = variableName }; v1.OptionalValuesList.Add(new OptionalValue("Jupiter")); v1.OptionalValuesList.Add(new OptionalValue("Saturn")); activity1.AddVariable(v1); ActSetVariableValue actSetVariableValue = new ActSetVariableValue() { VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.SetValue, Active = true, Value = "Jupiter" }; activity1.Acts.Add(actSetVariableValue); //Act mGR.RunRunner(); //Assert Assert.IsTrue(string.IsNullOrEmpty(actSetVariableValue.Error)); Assert.AreEqual(eRunStatus.Passed, mBF.RunStatus); Assert.AreEqual(eRunStatus.Passed, activity1.Status); Assert.AreEqual("Jupiter", v1.Value); }
public void TestVariable_RandomStringSetValue() { //Arrange int maxChars = 5; string variableName = "V1"; ResetBusinessFlow(); Activity activity1 = new Activity() { Active = true }; mBF.Activities.Add(activity1); VariableRandomString v1 = new VariableRandomString() { Name = variableName, Max = maxChars, IsUpperCase = true }; activity1.AddVariable(v1); ActSetVariableValue actSetVariableValue = new ActSetVariableValue() { VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.AutoGenerateValue, Active = true }; activity1.Acts.Add(actSetVariableValue); //Act mGR.RunRunner(); //Assert Assert.AreEqual(eRunStatus.Passed, mBF.RunStatus); Assert.AreEqual(eRunStatus.Passed, activity1.Status); Assert.AreEqual(v1.Value.ToUpper(), v1.Value); }