示例#1
0
        public void PropertyStatic()
        {
            MemberAssignment expr = Expression.Bind(MemberClass.GetStaticPropertyInfo(), Expression.Constant(1));

            Assert.AreEqual(MemberBindingType.Assignment, expr.BindingType, "Bind#09");
            Assert.AreEqual("StaticProperty = 1", expr.ToString(), "Bind#10");
        }
        public void StaticProperty2()
        {
            MemberExpression expr = Expression.Property(null, MemberClass.GetStaticPropertyInfo());

            Assert.AreEqual(ExpressionType.MemberAccess, expr.NodeType, "Property#11");
            Assert.AreEqual(typeof(int), expr.Type, "Property#12");
            Assert.AreEqual("MemberClass.StaticProperty", expr.ToString(), "Property#13");
        }
示例#3
0
        public void PropertyAccessorStatic()
        {
            MethodInfo mi = typeof(MemberClass).GetMethod("get_StaticProperty");

            MemberAssignment expr = Expression.Bind(mi, Expression.Constant(1));

            Assert.AreEqual(MemberBindingType.Assignment, expr.BindingType, "Bind#14");
            Assert.AreEqual("StaticProperty = 1", expr.ToString(), "Bind#15");
            Assert.AreEqual(MemberClass.GetStaticPropertyInfo(), expr.Member, "Bind#16");
        }
        public void StaticProperty3()
        {
            MethodInfo mi = typeof(MemberClass).GetMethod("get_StaticProperty");

            MemberExpression expr = Expression.Property(null, mi);

            Assert.AreEqual(ExpressionType.MemberAccess, expr.NodeType, "Property#14");
            Assert.AreEqual(typeof(int), expr.Type, "Property#15");
            Assert.AreEqual("MemberClass.StaticProperty", expr.ToString(), "Property#16");
            Assert.AreEqual(MemberClass.GetStaticPropertyInfo(), expr.Member, "Property#17");
        }