private void checkVariables(IVariableMap map, int expectedSize) { var variables = engineRule.HistoryService.CreateHistoricVariableInstanceQuery() /*.OrderByVariableName()*/ /*.Asc()*/ .ToList(); Assert.AreEqual(expectedSize, variables.Count); Assert.AreEqual(variables.Count, map.Count); foreach (var instance in variables) { Assert.True(map.ContainsKey(instance.Name)); var instanceValue = instance.TypedValue.Value; var mapValue = map.GetValueTyped <ITypedValue>(instance.Name) .Value; if (instanceValue == null) { Assert.IsNull(mapValue); } else if (instanceValue is byte[]) { Assert.Equals((byte[])instanceValue, (byte[])mapValue); } else { Assert.AreEqual(instanceValue, mapValue); } } }
// submit ///////////////////////////////////////////// public virtual void HandleSubmit(Delegate.IVariableScope variableScope, IVariableMap values, IVariableMap allValues) { var submittedValue = values.GetValueTyped <ITypedValue>(id); //values.remove(id); // perform validation foreach (var validationHandler in validationHandlers) { object value = null; if (submittedValue != null) { //value = submittedValue.Value; } validationHandler.Validate(value, allValues, this, variableScope); } // update variable(s) ITypedValue modelValue = null; if (submittedValue != null) { if (Type != null) { modelValue = Type.ConvertToModelValue(submittedValue); } else { modelValue = submittedValue; } } else if (defaultValueExpression != null) { if (Type != null) { // first, need to convert to model value since the default value may be a String Constant specified in the model xml. //modelValue = type.convertToModelValue(Variables.untypedValue(expressionValue)); } } if (modelValue != null) { if (!ReferenceEquals(id, null)) { variableScope.SetVariable(id, modelValue); } } }