private void ValidateConfigurationCrateStructure(StandardConfigurationControlsCM configCrate) { var controls = configCrate.Controls; Assert.AreEqual(1, controls.Count); var configurationControl = controls.FirstOrDefault(); Assert.IsInstanceOf <DropDownList>(configurationControl); Assert.AreEqual("Selected_Fr8_Object", configurationControl.Name); var configurationControlEvents = configurationControl.Events; Assert.AreEqual(1, configurationControlEvents.Count); var configurationControlEvent = configurationControlEvents.FirstOrDefault(); Assert.AreEqual("onChange", configurationControlEvent.Name); Assert.AreEqual("requestConfig", configurationControlEvent.Handler); Assert.NotNull(configurationControl.Source); var configurationControlSourceField = configurationControl.Source; Assert.AreEqual("Select Fr8 Object", configurationControlSourceField.Label); Assert.AreEqual("Field Description", configurationControlSourceField.ManifestType); }
private void AssertConfigureControls(StandardConfigurationControlsCM control) { Assert.AreEqual(1, control.Controls.Count, "Control count is not 1"); Assert.IsTrue(control.Controls[0] is TextBlock, "First control isn't a TextBlock"); Assert.AreEqual("Description", control.Controls[0].Label, "Invalid Label on control"); Assert.AreEqual("Description", control.Controls[0].Name, "Invalid Name on control"); }
protected async override Task <Crate> CreateDocusignTemplateConfigurationControls() { var multiLineTB = new TextBoxBig() { Label = "Volunteer Names", Name = "mltb" }; var fieldSelectDocusignTemplateDTO = new DropDownList { Label = "Use DocuSign Template", Name = "target_docusign_template", Required = true, Events = new List <ControlEvent>() { ControlEvent.RequestConfig }, Source = null }; var fieldsDTO = new List <ControlDefinitionDTO> { multiLineTB, fieldSelectDocusignTemplateDTO }; var controls = new StandardConfigurationControlsCM { Controls = fieldsDTO }; return(CrateManager.CreateStandardConfigurationControlsCrate("Configuration_Controls", fieldsDTO.ToArray())); }
private void AssertControls(StandardConfigurationControlsCM controls) { Assert.AreEqual(5, controls.Controls.Count); // Assert that first control is a RadioButtonGroup // with Label == "TemplateRecipientPicker" // and event: onChange => requestConfig. Assert.IsTrue(controls.Controls[4] is RadioButtonGroup); Assert.AreEqual("TemplateRecipientPicker", controls.Controls[4].Name); Assert.AreEqual(1, controls.Controls[4].Events.Count); Assert.AreEqual("onChange", controls.Controls[4].Events[0].Name); Assert.AreEqual("requestConfig", controls.Controls[4].Events[0].Handler); // Assert that 2nd-5th controls are a CheckBoxes // with corresponding labels and event: onChange => requestConfig. var checkBoxLabels = new[] { "EnvelopeSent", "EnvelopeReceived", "RecipientSigned" }; for (var i = 0; i < checkBoxLabels.Length; ++i) { var ci = i + 1; Assert.IsTrue(controls.Controls[ci] is CheckBox); Assert.AreEqual(checkBoxLabels[i], controls.Controls[ci].Name); Assert.AreEqual(1, controls.Controls[ci].Events.Count); Assert.AreEqual("onChange", controls.Controls[ci].Events[0].Name); Assert.AreEqual("requestConfig", controls.Controls[ci].Events[0].Handler); } // Assert that radio group contains two radios labeled "recipient" and "template". var radioButtonGroup = (RadioButtonGroup)controls.Controls[4]; Assert.AreEqual(2, radioButtonGroup.Radios.Count); Assert.AreEqual("recipient", radioButtonGroup.Radios[0].Name); Assert.AreEqual("template", radioButtonGroup.Radios[1].Name); // Assert that "recipient" radio contains single TextBox control // labeled "RecipientValue" with event "onChange" => "requestConfig". Assert.AreEqual(1, radioButtonGroup.Radios[0].Controls.Count); Assert.IsTrue(radioButtonGroup.Radios[0].Controls[0] is TextBox); Assert.AreEqual("RecipientValue", radioButtonGroup.Radios[0].Controls[0].Name); Assert.AreEqual(1, radioButtonGroup.Radios[0].Controls[0].Events.Count); Assert.AreEqual("onChange", radioButtonGroup.Radios[0].Controls[0].Events[0].Name); Assert.AreEqual("requestConfig", radioButtonGroup.Radios[0].Controls[0].Events[0].Handler); // Assert that "recipient" radio contains single DropDownList control // labeled "UpstreamCrate", with event "onChange" => "requestConfig", // with source labeled "Available Templates". Assert.AreEqual(1, radioButtonGroup.Radios[1].Controls.Count); Assert.IsTrue(radioButtonGroup.Radios[1].Controls[0] is DropDownList); Assert.AreEqual("UpstreamCrate", radioButtonGroup.Radios[1].Controls[0].Name); Assert.AreEqual(null, radioButtonGroup.Radios[1].Controls[0].Source); Assert.AreEqual(1, radioButtonGroup.Radios[1].Controls[0].Events.Count); Assert.AreEqual("onChange", radioButtonGroup.Radios[1].Controls[0].Events[0].Name); Assert.AreEqual("requestConfig", radioButtonGroup.Radios[1].Controls[0].Events[0].Handler); }
private void AssertConfigureControls(StandardConfigurationControlsCM control) { Assert.AreEqual(1, control.Controls.Count); Assert.IsTrue(control.Controls[0] is UpstreamCrateChooser); Assert.AreEqual("Store which crates?", control.Controls[0].Label); Assert.AreEqual("UpstreamCrateChooser", control.Controls[0].Name); }
private void AssertControls(StandardConfigurationControlsCM controls) { Assert.AreEqual(2, controls.Controls.Count); Assert.IsTrue(controls.Controls[0] is TextArea); Assert.AreEqual("TextArea", controls.Controls[0].Type); Assert.IsTrue(controls.Controls[1] is DropDownList); Assert.AreEqual("FinalActionsList", controls.Controls[1].Name); }
public void RemoveControl <T>(StandardConfigurationControlsCM configurationControls, string name) where T : ControlDefinitionDTO { var control = GetControl <T>(configurationControls, name); if (control != null) { configurationControls.Controls.Remove(control); } }
private void AssertControls(StandardConfigurationControlsCM controls) { Assert.AreEqual(5, controls.Controls.Count()); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "Track_Which_Envelopes")); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "NotificationHandler")); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "TimePeriod")); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "RecipientEvent")); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "EventInfo")); }
/**********************************************************************************/ // Activity logic can update state of configuration controls. But as long we have copied configuration controls crate from the storage into // new instance of ActivityUi changes made to ActivityUi won't be reflected in storage. // we have to persist in storage changes we've made to ActivityUi. // we do this in the most simple way by replacing old StandardConfigurationControlsCM with ActivityUi. private void SyncConfControlsBack() { Storage.Remove <StandardConfigurationControlsCM>(); // we create new StandardConfigurationControlsCM with controls from ActivityUi. // We do this because ActivityUi can has properties to access specific controls. We don't want those propeties exist in serialized crate. var configurationControlsToAdd = new StandardConfigurationControlsCM(ActivityUI.Controls); Storage.Add(Crate.FromContent(ConfigurationControlsLabel, configurationControlsToAdd, AvailabilityType.Configuration)); ActivityUI.SaveDynamicControlsTo(configurationControlsToAdd); }
private void AssertControls(StandardConfigurationControlsCM control) { Assert.AreEqual(1, control.Controls.Count); // Assert that first control is a TextBlock // with Label == "Monitor All DocuSign events" // with Value == "This Action doesn't require any configuration." Assert.IsTrue(control.Controls[0] is TextBlock); Assert.AreEqual("Monitor All DocuSign events", control.Controls[0].Label); Assert.AreEqual("This Action doesn't require any configuration.", control.Controls[0].Value); }
private void EnsureControlsCrate() { var controlsCrate = Storage.CratesOfType <StandardConfigurationControlsCM>().FirstOrDefault(); if (controlsCrate == null) { controlsCrate = Storage.Add(ConfigurationControlsLabel, new StandardConfigurationControlsCM()); } _configurationControls = controlsCrate.Content; }
public T GetControl <T>(StandardConfigurationControlsCM configurationControls, string name, string controlType = null) where T : ControlDefinitionDTO { Func <ControlDefinitionDTO, bool> predicate = x => x.Name == name; if (controlType != null) { predicate = x => x.Type == controlType && x.Name == name; } return((T)configurationControls?.Controls?.FirstOrDefault(predicate)); }
private void AssertConfigureControls(StandardConfigurationControlsCM control) { Assert.AreEqual(1, control.Controls.Count); // Assert that first control is a TextBlock // with Label == "No configuration" // with Name == "NoConfigLabel" Assert.IsTrue(control.Controls[0] is TextBlock); Assert.AreEqual("No configuration", control.Controls[0].Label); Assert.AreEqual("NoConfigLabel", control.Controls[0].Name); }
private void AssertConfigureControls(StandardConfigurationControlsCM control) { Assert.AreEqual(1, control.Controls.Count); // Assert that first control is a TextBox // with Label == "SQL Connection String" // with Name == "ConnectionString" Assert.IsTrue(control.Controls[0] is TextBox); Assert.AreEqual("SQL Connection String", control.Controls[0].Label); Assert.AreEqual("ConnectionString", control.Controls[0].Name); }
private void AssertConfigureControls(StandardConfigurationControlsCM control) { //Now there are three ControlsDefinitionDTO: TextBox for connnection string, Button "Continue" and dropDown to select table Assert.AreEqual(3, control.Controls.Count); // Assert that first control is a TextBox // with Label == "SQL Connection String" // with Name == "connection_string" Assert.IsTrue(control.Controls[0] is TextBox); Assert.AreEqual("SQL Connection String", control.Controls[0].Label); Assert.AreEqual("connection_string", control.Controls[0].Name); }
private void AssertErrorControls(StandardConfigurationControlsCM control) { Assert.AreEqual(2, control.Controls.Count); Assert.IsTrue(control.Controls[0] is TextBox); Assert.AreEqual("Connection String", control.Controls[0].Label); Assert.AreEqual("ConnectionString", control.Controls[0].Name); Assert.IsTrue(control.Controls[1] is TextBlock); Assert.AreEqual("Unexpected error", control.Controls[1].Label); Assert.AreEqual("ErrorLabel", control.Controls[1].Name); }
private void AssertControls(StandardConfigurationControlsCM controls) { Assert.AreEqual(1, controls.Controls.Count); // Assert that first control is a DropDownList // with Label == "target_docusign_template" // and event: onChange => requestConfig. Assert.IsTrue(controls.Controls[0] is DropDownList); Assert.AreEqual("target_docusign_template", controls.Controls[0].Name); Assert.AreEqual(1, controls.Controls[0].Events.Count); Assert.AreEqual("onChange", controls.Controls[0].Events[0].Name); Assert.AreEqual("requestConfig", controls.Controls[0].Events[0].Handler); }
protected StandardConfigurationControlsCM GetOrCreateStandardConfigurationControlsCM() { var controlsCM = _crateStorage .CrateContentsOfType <StandardConfigurationControlsCM>() .FirstOrDefault(); if (controlsCM == null) { controlsCM = new StandardConfigurationControlsCM(); _crateStorage.Add(Crate.FromContent(ConfigurationControlsLabel, controlsCM)); } return(controlsCM); }
private async Task ProcessCollectionControls(StandardConfigurationControlsCM collectionControls) { var fieldsPayloadCrate = Crate.FromContent(RuntimeFieldCrateLabelPrefix, new StandardPayloadDataCM(new KeyValueDTO[] { })); fieldsPayloadCrate.SourceActivityId = ActivityId.ToString(); Payload.Add(fieldsPayloadCrate); foreach (var controlDefinitionDTO in collectionControls.Controls) { ProcessCollectionControl(controlDefinitionDTO); } await ProcessFilePickers(collectionControls.Controls.Where(a => a.Type == ControlTypes.FilePicker)); }
private void AssertControls(StandardConfigurationControlsCM controls) { Assert.AreEqual(1, controls.Controls.Count); // Assert that first control is a TextBox // with Label == "Target Papertrail URL and Port (as URL:Port)" // and event: onChange => requestConfig. Assert.IsTrue(controls.Controls[0] is TextBox, "The target Papertrail URL text box is missing."); Assert.AreEqual("TargetUrlTextBox", controls.Controls[0].Name, "The name of the target URL text box is wrong."); //@AlexAvrutin: Commented this since this textbox does not require requestConfig event. //Assert.AreEqual(1, controls.Controls[0].Events.Count, "Event subscription is missing."); //Assert.AreEqual("onChange", controls.Controls[0].Events[0].Name, "onChange event is not subscribed"); //Assert.AreEqual("requestConfig", controls.Controls[0].Events[0].Handler, "requestConfig is not configured when onChange event."); }
private void AssertEquals(StandardConfigurationControlsCM expected, StandardConfigurationControlsCM actual) { expected = new StandardConfigurationControlsCM(expected.Controls); actual = new StandardConfigurationControlsCM(actual.Controls); var crate = Crate.FromContent(string.Empty, expected); var expectedDto = CrateStorageSerializer.Default.ConvertToDto(crate); crate.Put(actual); var actualdDto = CrateStorageSerializer.Default.ConvertToDto(crate); Assert.AreEqual(JsonConvert.SerializeObject(expectedDto), JsonConvert.SerializeObject(actualdDto)); }
protected Crate <StandardConfigurationControlsCM> EnsureControlsCrate() { var controlsCrate = Storage.CratesOfType <StandardConfigurationControlsCM>().FirstOrDefault(); if (controlsCrate == null) { controlsCrate = CrateManager.CreateStandardConfigurationControlsCrate(ConfigurationControlsLabel); Storage.Add(controlsCrate); } _configurationControls = controlsCrate.Content; return(controlsCrate); }
private GroupMessage GetGroupMessageFields(StandardConfigurationControlsCM ui, ICrateStorage payload) { var controls = new ActivityUi(); controls.ClonePropertiesFrom(ui); var groupMessage = new GroupMessage(); groupMessage.GroupID = controls.Groups.Value; //Quick fix FR-2719 var messageField = GetControl <TextSource>("Message"); groupMessage.Message = messageField.TextValue; return(groupMessage); }
public static void UpdateControls <TActivityUi>(this ICrateStorage storage, Action <TActivityUi> action) where TActivityUi : StandardConfigurationControlsCM, new() { if (action == null) { throw new ArgumentNullException(nameof(action)); } var controlsCrate = storage.FirstCrate <StandardConfigurationControlsCM>(); var activityUi = new TActivityUi().ClonePropertiesFrom(controlsCrate.Content) as TActivityUi; activityUi.RestoreDynamicControlsFrom(controlsCrate.Content); action(activityUi); var newControls = new StandardConfigurationControlsCM(activityUi.Controls.ToArray()); storage.ReplaceByLabel(Crate.FromContent(controlsCrate.Label, newControls)); activityUi.SaveDynamicControlsTo(newControls); }
private void ValidateConfigurationCrateStructure(StandardConfigurationControlsCM configCrate) { var controls = configCrate.Controls; Assert.AreEqual(1, controls.Count); var configurationControl = controls.FirstOrDefault(); Assert.IsInstanceOf <Duration>(configurationControl); Assert.AreEqual("Delay_Duration", configurationControl.Name); Assert.AreEqual("Please enter delay duration", configurationControl.Label); var configurationControlEvents = configurationControl.Events; Assert.IsEmpty(configurationControlEvents); Assert.IsNull(configurationControl.Source); }
public void ExtactAndAssignValues(StandardConfigurationControlsCM configurationControls, ICrateStorage payloadStorage) { if (configurationControls.Controls == null) { return; } foreach (var configurationControl in configurationControls.EnumerateControlsDefinitions()) { IUpstreamValueExtractor valueExtractor; if (_valueExtractors.TryGetValue(configurationControl.GetType(), out valueExtractor)) { valueExtractor.ExtractUpstreamValue(configurationControl, payloadStorage); } } }
private void AssertControls(StandardConfigurationControlsCM controls) { // Assert that DataSource , DocuSignTemplate and Button control are present Assert.AreEqual(3, controls.Controls.Count()); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "DataSource")); Assert.AreEqual(1, controls.Controls.Count(x => x.Name == "DocuSignTemplate")); Assert.AreEqual(1, controls.Controls.Count(x => x.Type == "Button")); // Assert that DataSource dropdown contains sources and it should be only "Get" var dataSourceDropdown = (DropDownList)controls.Controls[0]; Assert.AreEqual(3, dataSourceDropdown.ListItems.Count()); // Assert that Dropdownlist source is null. var templateDropdown = (DropDownList)controls.Controls[1]; Assert.AreEqual(null, templateDropdown.Source); }
public Crate No_SMS_Number_Controls() { var controls = new StandardConfigurationControlsCM( new TextSource { UpstreamSourceLabel = "Upstream Terminal-Provided Fields", InitialLabel = "SMS Number", Name = "SMS_Number", Value = ConfigurationManager.AppSettings["TestPhoneNumber"], Label = "SMS Number" }, new TextSource { UpstreamSourceLabel = "Upstream Terminal-Provided Fields", InitialLabel = "SMS Body", Name = "SMS_Body", Value = "That is the message that we are sending", Label = "SMS Body" }); return(Crate.FromContent("Configuration_Controls", controls)); }
private void AssertConfigurationControls(StandardConfigurationControlsCM control) { Assert.AreEqual(4, control.Controls.Count, "Control count is not 4"); Assert.IsTrue(control.Controls.Count(x => x.GetType() == typeof(DropDownList)) == 3); Assert.IsTrue(control.Controls.Count(x => x.GetType() == typeof(TextSource)) == 1); }
protected Crate PackControls(StandardConfigurationControlsCM page) { return(PackControlsCrate(page.Controls.ToArray())); }