示例#1
0
        // When using interface and new() generic constraints, expression contains Convert to the interface.
        private void TryGetPropertyNameGeneric <T>()
            where T : ITest1, new()
        {
            Expression <Func <T, object> > expression = test => test.Y;

            Assert.AreEqual("Y", ReflectionExpressions.TryGetPropertyName(expression));
        }
示例#2
0
        public void TryGetIndexedPropertyNameTest()
        {
            Expression <Func <Test2, object> > expression = test => test[default(string)];

            Assert.AreEqual("Item", ReflectionExpressions.TryGetPropertyName(expression));
        }
示例#3
0
        public void TryGetPropertyNameTest()
        {
            Expression <Func <Test2, object> > expression = test => test.X;

            Assert.AreEqual("X", ReflectionExpressions.TryGetPropertyName(expression));
        }
示例#4
0
 public void TryGetPropertyNameNullTest3()
 {
     Assert.IsNull(ReflectionExpressions.TryGetPropertyName((LambdaExpression)null));
 }
示例#5
0
 public void TryGetPropertyNameNullTest2()
 {
     Assert.IsNull(ReflectionExpressions.TryGetPropertyName((Expression <Func <object> >)null));
 }