Ejemplo n.º 1
0
        public void NumericExpressionTreeTest()
        {
            const string name       = "net";
            var          expression = new MultiplyOperator(Two, TwentyOne);
            var          net        = new NumericExpressionTree(name, expression);

            Console.Write("Created new NumericExpressionTree: ");
            Console.WriteLine(net);
            Console.WriteLine("NumericExpressionTreeTest: test Name property...");
            Expect(net.Name == name);
            Console.WriteLine("NumericExpressionTreeTest: test expression and ResolveReferences()...");
            IDictionary <string, IValue> nmap = new Dictionary <string, IValue>();
            IValue value = net.ResolveReferences(nmap);

            Expect(value.Value == 42.0f);
            Console.WriteLine("NumericExpressionTreeTest: testing map size (1)...");
            Expect(nmap.Count == 1);
            Console.WriteLine("NumericExpressionTreeTest: testing map contents...");
            Expect(nmap[name] == value);
        }
Ejemplo n.º 2
0
 public Expression(NumericExpressionTree expressionTree, IDictionary <string, IValue> map)
 {
     _tree       = expressionTree;
     _expression = expressionTree.ResolveReferences(map);
 }