コード例 #1
0
        public void PropertyExpressionForgetStatic()
        {
            // Forgets to mark the item as static
            var c       = new PropertyExpressionTransformer();
            var f       = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadStatic");

            var pnew = c.Transform(paccess);
        }
コード例 #2
0
        public void PropertyExpressionWrongSignature()
        {
            // Totally wrong signature
            var c       = new PropertyExpressionTransformer();
            var f       = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadSignature");

            var pnew = c.Transform(paccess);
        }
コード例 #3
0
        public void PropertyExpressionWrongReturnType()
        {
            // everything right but return type wrong.
            var c       = new PropertyExpressionTransformer();
            var f       = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadReturn");

            var pnew = c.Transform(paccess);
        }
コード例 #4
0
        public void PropertyExpressionConstant()
        {
            var c       = new PropertyExpressionTransformer();
            var f       = new PETest();
            var paccess = Expression.Property(Expression.Constant(f), "theConstant");

            var pnew = c.Transform(paccess);

            Assert.IsNotNull(pnew);
            Assert.AreEqual("f => 10.Invoke(value(LINQToTTreeLib.Tests.QueryVisitors.PropertyExpressionTransformerTest+PETest))", pnew.ToString());
        }
コード例 #5
0
        public void PropertyExpressionNoReplacementP()
        {
            var c = new PropertyExpressionTransformer();
            var f = new PETest();
            var paccess = Expression.Property(Expression.Constant(f), "thePropertyRaw");

            var pnew = c.Transform(paccess);

            Assert.IsNotNull(pnew);
            Assert.IsInstanceOfType(pnew, typeof(MemberExpression));
            var pnewme = pnew as MemberExpression;
            Assert.AreEqual("thePropertyRaw", pnewme.Member.Name);
        }
コード例 #6
0
        public void PropertyExpressionNoReplacementF()
        {
            var c       = new PropertyExpressionTransformer();
            var f       = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldRaw");

            var pnew = c.Transform(paccess);

            Assert.IsNotNull(pnew);
            Assert.IsInstanceOfType(pnew, typeof(MemberExpression));
            var pnewme = pnew as MemberExpression;

            Assert.AreEqual("theFieldRaw", pnewme.Member.Name);
        }
コード例 #7
0
        public void PropertyExpressionForgetStatic()
        {
            // Forgets to mark the item as static
            var c = new PropertyExpressionTransformer();
            var f = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadStatic");

            var pnew = c.Transform(paccess);
        }
コード例 #8
0
        public void PropertyExpressionWrongSignature()
        {
            // Totally wrong signature
            var c = new PropertyExpressionTransformer();
            var f = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadSignature");

            var pnew = c.Transform(paccess);
        }
コード例 #9
0
        public void PropertyExpressionWrongReturnType()
        {
            // everything right but return type wrong.
            var c = new PropertyExpressionTransformer();
            var f = new PETest();
            var paccess = Expression.Field(Expression.Constant(f), "theFieldBadReturn");

            var pnew = c.Transform(paccess);
        }
コード例 #10
0
        public void PropertyExpressionConstant()
        {
            var c = new PropertyExpressionTransformer();
            var f = new PETest();
            var paccess = Expression.Property(Expression.Constant(f), "theConstant");

            var pnew = c.Transform(paccess);

            Assert.IsNotNull(pnew);
            Assert.AreEqual("f => 10.Invoke(value(LINQToTTreeLib.Tests.QueryVisitors.PropertyExpressionTransformerTest+PETest))", pnew.ToString());
        }