public void ResolveMemberAccess_OnEntityRefMemberExpression_WithSuccessfulOptimization() { var memberInfo = typeof(Cook).GetProperty("Substitution"); var entityRefMemberExpression = SqlStatementModelObjectMother.CreateSqlEntityRefMemberExpression(); var fakeResolvedExpression = ExpressionHelper.CreateExpression(); _resolverMock .Expect(mock => mock.TryResolveOptimizedMemberExpression(entityRefMemberExpression, memberInfo)) .Return(fakeResolvedExpression); var result = MemberAccessResolver.ResolveMemberAccess(entityRefMemberExpression, memberInfo, _resolverMock, _stageMock, _mappingResolutionContext); _resolverMock.VerifyAllExpectations(); _stageMock.AssertWasNotCalled( mock => mock.ResolveEntityRefMemberExpression( Arg <SqlEntityRefMemberExpression> .Is.Anything, Arg <IJoinInfo> .Is.Anything, Arg <IMappingResolutionContext> .Is.Anything)); Assert.That(result, Is.SameAs(fakeResolvedExpression)); }