From 5c018064fb57ea5bca65ede1382fda8f8c5de8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delaporte?= Date: Mon, 9 Oct 2017 13:56:46 +0200 Subject: [PATCH] Restrict a test to Sql Server --- .../SqlConverterAndMultiQuery/Fixture.cs | 13 ++++++++----- .../SqlConverterAndMultiQuery/Fixture.cs | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs b/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs index 7b868dc8f81..fc8c339848e 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs @@ -9,7 +9,8 @@ using NHibernate.Cfg; -using NHibernate.Dialect; +using NHibernate.Driver; +using NHibernate.Engine; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery @@ -25,11 +26,13 @@ protected override void Configure(Configuration configuration) configuration.DataBaseIntegration(x => x.ExceptionConverter()); } - protected override bool AppliesTo(Dialect.Dialect dialect) + protected override bool AppliesTo(ISessionFactoryImplementor factory) { - // MsSqlCe throws InvalidOperationException instead of a DbException for these tests, preventing - // the test SqlConverter to do its job. - return !(Dialect is MsSqlCeDialect); + // Test current implementation allows to test mmostly SQL Server. Other databases + // tend to (validly) send InvalidOperationException during prepare phase due to the closed + // connection, which get not converted. For testing other case, maybe a failure caused by a + // schema mismatch (like done in transaction tests) would be better. + return factory.ConnectionProvider.Driver is SqlClientDriver; } [Test] diff --git a/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs index d21099f02bc..5d822391ca9 100644 --- a/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs @@ -1,5 +1,6 @@ using NHibernate.Cfg; -using NHibernate.Dialect; +using NHibernate.Driver; +using NHibernate.Engine; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery @@ -14,11 +15,13 @@ protected override void Configure(Configuration configuration) configuration.DataBaseIntegration(x => x.ExceptionConverter()); } - protected override bool AppliesTo(Dialect.Dialect dialect) + protected override bool AppliesTo(ISessionFactoryImplementor factory) { - // MsSqlCe throws InvalidOperationException instead of a DbException for these tests, preventing - // the test SqlConverter to do its job. - return !(Dialect is MsSqlCeDialect); + // Test current implementation allows to test mmostly SQL Server. Other databases + // tend to (validly) send InvalidOperationException during prepare phase due to the closed + // connection, which get not converted. For testing other case, maybe a failure caused by a + // schema mismatch (like done in transaction tests) would be better. + return factory.ConnectionProvider.Driver is SqlClientDriver; } [Test]