コード例 #1
0
 public ExprMinMaxRowNodeForge(
     ExprMinMaxRowNode parent,
     Type resultType)
 {
     ForgeRenderable = parent;
     EvaluationType = resultType;
 }
コード例 #2
0
        public void TestEvaluate()
        {
            minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MAX);
            SetupNode(minMaxNode, 10, 1.5, null);
            Assert.AreEqual(10d, minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MAX);
            SetupNode(minMaxNode, 1, 1.5, null);
            Assert.AreEqual(1.5d, minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MIN);
            SetupNode(minMaxNode, 1, 1.5, null);
            Assert.AreEqual(1d, minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MAX);
            SetupNode(minMaxNode, 1, 1.5, 2.0f);
            Assert.AreEqual(2.0d, minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MIN);
            SetupNode(minMaxNode, 6, 3.5, 2.0f);
            Assert.AreEqual(2.0d, minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));

            minMaxNode = MakeNode(null, typeof(int?), 5, typeof(int?), 6, typeof(int?));
            Assert.IsNull(minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));
            minMaxNode = MakeNode(7, typeof(int?), null, typeof(int?), 6, typeof(int?));
            Assert.IsNull(minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));
            minMaxNode = MakeNode(3, typeof(int?), 5, typeof(int?), null, typeof(int?));
            Assert.IsNull(minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));
            minMaxNode = MakeNode(null, typeof(int?), null, typeof(int?), null, typeof(int?));
            Assert.IsNull(minMaxNode.Forge.ExprEvaluator.Evaluate(null, false, null));
        }
コード例 #3
0
        private void SetupNode(
            ExprMinMaxRowNode nodeMin,
            int intValue,
            double doubleValue,
            float?floatValue)
        {
            nodeMin.AddChildNode(new SupportExprNode(intValue));
            nodeMin.AddChildNode(new SupportExprNode(doubleValue));
            if (floatValue != null)
            {
                nodeMin.AddChildNode(new SupportExprNode(floatValue));
            }

            nodeMin.Validate(SupportExprValidationContextFactory.MakeEmpty(container));
        }
コード例 #4
0
        private ExprMinMaxRowNode MakeNode(
            object valueOne,
            Type typeOne,
            object valueTwo,
            Type typeTwo,
            object valueThree,
            Type typeThree)
        {
            var maxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MAX);

            maxNode.AddChildNode(new SupportExprNode(valueOne, typeOne));
            maxNode.AddChildNode(new SupportExprNode(valueTwo, typeTwo));
            maxNode.AddChildNode(new SupportExprNode(valueThree, typeThree));
            maxNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container));
            return(maxNode);
        }
コード例 #5
0
 public void SetUp()
 {
     minMaxNode = new ExprMinMaxRowNode(MinMaxTypeEnum.MAX);
 }