コード例 #1
0
 public void ShouldThrowNotSupportedOnNonMembers()
 {
     var myClass = new TestClass();
     Expression<Func<TestClass, string>> expression = x => myClass.SomeData;
     var expressionVisitor = new ExpressionVisitor();
     expressionVisitor.GetMemberNameFromExpression(expression);
 }
コード例 #2
0
 public void ShouldModifyIdNameFromLambdaExpression()
 {
     Expression<Func<TestClass, string>> expression = x => x.Id;
     var expressionVisitor = new ExpressionVisitor();
     var memberName = expressionVisitor.GetMemberNameFromExpression(expression);
     Assert.That(memberName, Is.EqualTo("_id"));
 }
コード例 #3
0
 public void ShouldThrowNotSupportedOnConstants()
 {
     Expression<Func<TestClass, string>> expression = x => "some nonsense";
     var expressionVisitor = new ExpressionVisitor();
     expressionVisitor.GetMemberNameFromExpression(expression);
 }
コード例 #4
0
 public void ShouldGetMemberNameFromDeeplyNestedLambdaExpression()
 {
     Expression<Func<TestClass, string>> expression = x => x.EmbeddedData.DeeplyEmbeddedData.EvenMoreData;
     var expressionVisitor = new ExpressionVisitor();
     var memberName = expressionVisitor.GetMemberNameFromExpression(expression);
     Assert.That(memberName, Is.EqualTo("EmbeddedData.DeeplyEmbeddedData.EvenMoreData"));
 }