public void FromFieldEntity_String() { var f = new StringField(); ExprType res = ExprTypeHelper.FromFieldEntity(f); Assert.That(res.Type, Is.EqualTo(DataType.String)); }
public void FromFieldEntity_Currency() { var f = new CurrencyField(); f.DecimalPlaces = 5; ExprType res = ExprTypeHelper.FromFieldEntity(f); Assert.That(res.Type, Is.EqualTo(DataType.Currency)); Assert.That(res.DecimalPlaces, Is.EqualTo(5)); }
/// <summary> /// Create compilation settings that are appropriate for a given field. /// </summary> /// <param name="calculatedField">The calculated field.</param> /// <param name="settings">The settings.</param> /// <returns></returns> internal static BuilderSettings CreateBuilderSettingsForField(Field calculatedField, CalculatedFieldSettings settings) { // Determine calculation context type EntityType type = calculatedField.FieldIsOnType; ExprType contextType = ExprTypeHelper.EntityOfType(new EntityRef(type.Id)); // Determine result type ExprType expectedResult = ExprTypeHelper.FromFieldEntity(calculatedField); expectedResult.DisallowList = true; // Create settings BuilderSettings builderSettings = new BuilderSettings(); builderSettings.ScriptHost = ScriptHostType.Any; builderSettings.RootContextType = contextType; builderSettings.ExpectedResultType = expectedResult; return(builderSettings); }