当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionGenerator.Join方法代码示例

本文整理汇总了C#中ExpressionGenerator.Join方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionGenerator.Join方法的具体用法?C# ExpressionGenerator.Join怎么用?C# ExpressionGenerator.Join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExpressionGenerator的用法示例。


在下文中一共展示了ExpressionGenerator.Join方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test051

        public void Test051()
        {
            var xgr = new ExpressionGenerator();
            Func<Expression, BinaryExpression> conv = x => (BinaryExpression)x;

            var el = new Expression[] {
                Expression.Default(typeof(decimal)),
                Expression.Default(typeof(decimal))
            };

            var result = xgr.Join<decimal>(el, ExpressionType.Add);
            Assert.IsInstanceOfType(result.Body, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, result.Body.NodeType);
            Assert.AreEqual(el[0], conv(result.Body).Left);
            Assert.AreEqual(el[1], conv(result.Body).Right);
        }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:16,代码来源:ExpressionGenerator.Tests.cs

示例2: Test048

        public void Test048()
        {
            var xgr = new ExpressionGenerator();
            Func<Expression, BinaryExpression> conv = x => (BinaryExpression)x;

            var result = xgr.Join(null, ExpressionType.Add);

            Assert.IsNull(result);
        }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:9,代码来源:ExpressionGenerator.Tests.cs

示例3: Test049

        public void Test049()
        {
            var xgr = new ExpressionGenerator();
            Func<Expression, BinaryExpression> conv = x => (BinaryExpression)x;

            var el = new Expression[] {
                Expression.Default(typeof(int))
            };

            var result = xgr.Join(el, ExpressionType.Add);

            Assert.AreEqual(el[0], result);
        }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:13,代码来源:ExpressionGenerator.Tests.cs

示例4: Test046

        public void Test046()
        {
            var xgr = new ExpressionGenerator();
            Func<Expression, BinaryExpression> conv = x => (BinaryExpression)x;

            var el = new Expression[] {
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
                Expression.Default(typeof(int)),
            };

            var result = xgr.Join(el, ExpressionType.Add);
            Assert.IsInstanceOfType(result, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, result.NodeType);

            Assert.IsInstanceOfType(conv(result).Left, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(result).Left.NodeType);

            Assert.IsInstanceOfType(conv(conv(result).Left).Left, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(conv(result).Left).Left.NodeType);

            Assert.AreEqual(el[0], conv(conv(conv(result).Left).Left).Left);
            Assert.AreEqual(el[1], conv(conv(conv(result).Left).Left).Right);

            Assert.IsInstanceOfType(conv(conv(result).Left).Right, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(conv(result).Left).Right.NodeType);

            Assert.AreEqual(el[2], conv(conv(conv(result).Left).Right).Left);
            Assert.AreEqual(el[3], conv(conv(conv(result).Left).Right).Right);

            Assert.IsInstanceOfType(conv(result).Right, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(result).Right.NodeType);

            Assert.IsInstanceOfType(conv(conv(result).Right).Left, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(conv(result).Right).Left.NodeType);

            Assert.AreEqual(el[4], conv(conv(conv(result).Right).Left).Left);
            Assert.AreEqual(el[5], conv(conv(conv(result).Right).Left).Right);

            Assert.IsInstanceOfType(conv(conv(result).Right).Right, typeof(BinaryExpression));
            Assert.AreEqual(ExpressionType.Add, conv(conv(result).Right).Right.NodeType);

            Assert.AreEqual(el[6], conv(conv(conv(result).Right).Right).Left);
            Assert.AreEqual(el[7], conv(conv(conv(result).Right).Right).Right);
        }
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:50,代码来源:ExpressionGenerator.Tests.cs


注:本文中的ExpressionGenerator.Join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。