public void SkipChainedNonConstantMemberAccess() { var input = (Expression <Func <A, A> >)(x => x.Property.Property); var output = PreProcessors.ReduceConstantMemberAccess(input); output.ShouldBeLike(input); }
public void ReduceConstantMemberAccess() { var test = new A { Property = new A { Property = new A() } }; var expression = PreProcessors.ReduceConstantMemberAccess((Expression <Func <A> >)( () => test.Property.Property )); // Assertion is like this, because of this: https://stackoverflow.com/questions/60452684/net-core-and-type-equality (expression as Expression <Func <A> >) .Body.ShouldBeOfType <ConstantExpression>() .Value.ShouldBe(test.Property.Property); }