public void ShouldThrowNotSupportedOnNonMembers() { var myClass = new TestClass(); Expression<Func<TestClass, string>> expression = x => myClass.SomeData; var expressionVisitor = new ExpressionVisitor(); expressionVisitor.GetMemberNameFromExpression(expression); }
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")); }
public void ShouldThrowNotSupportedOnConstants() { Expression<Func<TestClass, string>> expression = x => "some nonsense"; var expressionVisitor = new ExpressionVisitor(); expressionVisitor.GetMemberNameFromExpression(expression); }
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")); }