Exemplo n.º 1
0
        public void CreateSqlQuery_NotSupportedException_InResolutionStage()
        {
            var exception = new NotSupportedException("Bla.");

            _preparationStageMock
            .Stub(mock => mock.PrepareSqlStatement(_queryModel, null))
            .Return(CreateSqlStatement());

            _resolutionStageMock
            .Stub(mock => mock.ResolveSqlStatement(Arg <SqlStatement> .Is.Anything, Arg <MappingResolutionContext> .Is.TypeOf))
            .Throw(exception);

            Assert.That(
                () => _sqlQueryGenerator.CreateSqlQuery(_queryModel),
                Throws.TypeOf <NotSupportedException> ().With.Message.EqualTo(
                    "There was an error preparing or resolving query 'from Order o in null select null' for SQL generation. Bla."));
        }