// 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)); }
public void TryGetIndexedPropertyNameTest() { Expression <Func <Test2, object> > expression = test => test[default(string)]; Assert.AreEqual("Item", ReflectionExpressions.TryGetPropertyName(expression)); }
public void TryGetPropertyNameTest() { Expression <Func <Test2, object> > expression = test => test.X; Assert.AreEqual("X", ReflectionExpressions.TryGetPropertyName(expression)); }
public void TryGetPropertyNameNullTest3() { Assert.IsNull(ReflectionExpressions.TryGetPropertyName((LambdaExpression)null)); }
public void TryGetPropertyNameNullTest2() { Assert.IsNull(ReflectionExpressions.TryGetPropertyName((Expression <Func <object> >)null)); }