public void Test2() { using var eps = new ExpressionParsingService(); eps.RegisterFunctionsAssembly(typeof(ExternalExtractorUnitTests).GetTypeInfo().Assembly); using ComputedExpression interpreted = eps.Interpret("\"I am silly very much\""); Assert.NotNull(interpreted); Assert.True(interpreted.RecognizedCorrectly); Assert.True(interpreted.IsConstant); Assert.Equal( "I am stupid very much", interpreted.Compute()); }
public void Test4() { using var eps = new ExpressionParsingService(); eps.RegisterFunctionsAssembly(typeof(ExternalExtractorUnitTests).GetTypeInfo().Assembly); using ComputedExpression interpreted = eps.Interpret("substring(\"alabalaportocala\",bumbly dumb)"); Assert.NotNull(interpreted); Assert.True(interpreted.RecognizedCorrectly); Assert.True(interpreted.IsConstant); Assert.Equal( "abalaportocala", interpreted.Compute()); }
public void Test1() { using var eps = new ExpressionParsingService(); eps.RegisterFunctionsAssembly(typeof(ExternalExtractorUnitTests).GetTypeInfo().Assembly); using ComputedExpression interpreted = eps.Interpret("1+silly+3"); Assert.NotNull(interpreted); Assert.True(interpreted.RecognizedCorrectly); Assert.Contains( interpreted.GetParameterNames(), p => p == "stupid"); Assert.DoesNotContain( interpreted.GetParameterNames(), p => p == "silly"); }