Example #1
0
        public void ResolveSqlTable_ResolvesJoinInfo()
        {
            var memberInfo         = typeof(Kitchen).GetProperty("Cook");
            var entityExpression   = SqlStatementModelObjectMother.CreateSqlEntityDefinitionExpression(typeof(Kitchen));
            var unresolvedJoinInfo = new UnresolvedJoinInfo(entityExpression, memberInfo, JoinCardinality.One);
            var join = _sqlTable.GetOrAddLeftJoin(unresolvedJoinInfo, memberInfo);

            var fakeResolvedJoinInfo = SqlStatementModelObjectMother.CreateResolvedJoinInfo(typeof(Cook));

            using (_stageMock.GetMockRepository().Ordered())
            {
                _stageMock
                .Expect(mock => mock.ResolveTableInfo(_unresolvedTableInfo, _mappingResolutionContext))
                .Return(_fakeResolvedSimpleTableInfo);
                _stageMock
                .Expect(mock => mock.ResolveJoinInfo(join.JoinInfo, _mappingResolutionContext))
                .Return(fakeResolvedJoinInfo);
            }
            _stageMock.Replay();

            _visitor.ResolveSqlTable(_sqlTable);

            _stageMock.VerifyAllExpectations();
            Assert.That(join.JoinInfo, Is.SameAs(fakeResolvedJoinInfo));
        }