Skip to content

Commit

Permalink
Restrict a test to Sql Server
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericDelaporte authored and hazzik committed Oct 10, 2017
1 parent 6cfb2a2 commit 5c01806
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@


using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernate.Engine;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery
Expand All @@ -25,11 +26,13 @@ protected override void Configure(Configuration configuration)
configuration.DataBaseIntegration(x => x.ExceptionConverter<SqlConverter>());
}

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]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernate.Engine;
using NUnit.Framework;

namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery
Expand All @@ -14,11 +15,13 @@ protected override void Configure(Configuration configuration)
configuration.DataBaseIntegration(x => x.ExceptionConverter<SqlConverter>());
}

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]
Expand Down

0 comments on commit 5c01806

Please sign in to comment.