private void ValidateTriggerData(WorkflowDataValidationResult result, IeTrigger trigger, bool ignoreIds) { if (trigger == null) { return; } ValidateConditionData(result, trigger.Condition, ignoreIds); ValidateActionData(result, trigger.Action, ignoreIds); }
public void ToXmlModel_PropertyChangeAction_ChoiceProperty_DuplicateValidValue_ResultHasCorrectIds() { // Arrange const string propertyName = "Choice Property"; var converter = new TriggerConverter(); var trigger = new IeTrigger { Action = new IePropertyChangeAction { PropertyName = propertyName, ValidValues = new List <IeValidValue> { new IeValidValue { Id = 1, Value = "test" }, new IeValidValue { Id = 2, Value = "test" } } } }; var dataMaps = new WorkflowDataMaps(); dataMaps.PropertyTypeMap.Add(propertyName, 1); dataMaps.ValidValuesById.Add(1, new Dictionary <int, string> { { 1, "test" }, { 2, "test" } }); dataMaps.ValidValuesByValue.Add(1, new Dictionary <string, int> { { "test", 1 } }); // Act var xmlModel = converter.ToXmlModel(new[] { trigger }, dataMaps); // Assert var xmlAction = (XmlPropertyChangeAction)xmlModel.Triggers[0].Action; Assert.AreEqual(2, xmlAction.ValidValues.Count); Assert.IsTrue(xmlAction.ValidValues.Contains(1)); Assert.IsTrue(xmlAction.ValidValues.Contains(2)); }
private static XmlWorkflowEventTrigger ToXmlModel(IeTrigger ieTrigger, WorkflowDataMaps dataMaps) { if (ieTrigger == null) { return(null); } var xmlTrigger = new XmlWorkflowEventTrigger { Name = ieTrigger.Name }; if (ieTrigger.Condition != null) { xmlTrigger.Condition = ToXmlModel(ieTrigger.Condition, dataMaps.StateMap); } // Triggers must have an action. xmlTrigger.Action = ToXmlModel(ieTrigger.Action, dataMaps); return(xmlTrigger); }