protected internal override bool?CoerceToBoolean(object value) { if (value is bool?) { return((bool?)value); } else { throw LOG.unableToConvertValue(value, typeof(bool?)); } }
public virtual bool EvaluateSimpleUnaryTests(string simpleUnaryTests, string inputName, IVariableContext variableContext) { try { ELContext elContext = CreateContext(variableContext); ValueExpression valueExpression = TransformSimpleUnaryTests(simpleUnaryTests, inputName, elContext); return((bool)valueExpression.GetValue(elContext)); } catch (FeelMissingFunctionException e) { throw LOG.UnknownFunction(simpleUnaryTests, e); } catch (FeelMissingVariableException e) { if (inputName.Equals(e.GetVariable())) { throw LOG.unableToEvaluateExpressionAsNotInputIsSet(simpleUnaryTests, e); } else { throw LOG.unknownVariable(simpleUnaryTests, e); } } catch (FeelConvertException e) { throw LOG.unableToConvertValue(simpleUnaryTests, e); } catch (ELException e) { if (e.InnerException is FeelMethodInvocationException) { throw LOG.unableToInvokeMethod(simpleUnaryTests, (FeelMethodInvocationException)e.InnerException); } else { throw LOG.unableToEvaluateExpression(simpleUnaryTests, e); } } }