コード例 #1
0
        public void Real_Word_Example2()
        {
            string input = "NumberOfCards == 30 || 1+2 < 3+3 && 3*2 <= 7 && Three > (1-1)";

            Dictionary <string, double> preDefinedVariables = new Dictionary <string, double>
            {
                { "NumberOfCards", 30.1 },
                { "Three", 3 }
            };

            BRE    bRE    = new BRE();
            object result = bRE.EvaluateSentence(input, preDefinedVariables);

            Assert.Equal(true, result);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: allip1/RuleEngine
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Needing argument!");
            }
            else
            {
                var engine = new BRE();

                var result = engine.EvaluateSentence(args[0], new System.Collections.Generic.Dictionary <string, double>());

                Console.WriteLine(result);
            }
        }
コード例 #3
0
        public void Text_To_AST_To_Text()
        {
            string input = "NumberOfCards > 30 && Three > (1 + 1)";

            Dictionary <string, double> preDefinedVariables = new Dictionary <string, double>
            {
                { "NumberOfCards", 30.1 },
                { "Three", 3 }
            };

            BRE bRE = new BRE();
            var ast = bRE.SentenceToExpression(input, preDefinedVariables);

            String result = bRE.ExpressionToSentence(ast, preDefinedVariables);

            Assert.Equal(input, result);
        }