Skip to content

Commit 3a0a383

Browse files
If prepare_sql is enabled, ignore an incompatible test.
1 parent 25fc4d3 commit 3a0a383

File tree

2 files changed

+12
-4
lines changed
  • src/NHibernate.Test
    • Async/NHSpecificTest/SqlConverterAndMultiQuery
    • NHSpecificTest/SqlConverterAndMultiQuery

2 files changed

+12
-4
lines changed

src/NHibernate.Test/Async/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using NHibernate.Cfg;
1212
using NHibernate.Dialect;
13+
using NHibernate.Util;
1314
using NUnit.Framework;
1415

1516
namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery
@@ -27,9 +28,12 @@ protected override void Configure(Configuration configuration)
2728

2829
protected override bool AppliesTo(Dialect.Dialect dialect)
2930
{
30-
// MsSqlCe throws InvalidOperationException instead of a DbException for these tests, preventing
31+
// If prepare_sql is enabled, with most databases prepare will fail with an InvalidOperationException,
32+
// turned into ADOException by prepare code and then not passed to the exception converter.
33+
// MsSqlCe throws InvalidOperationException during Prepare (even when disabled), preventing
3134
// the test SqlConverter to do its job.
32-
return !(Dialect is MsSqlCeDialect);
35+
var prepareSql = PropertiesHelper.GetBoolean(Environment.PrepareSql, cfg.Properties, false);
36+
return !(prepareSql || Dialect is MsSqlCeDialect);
3337
}
3438

3539
[Test]

src/NHibernate.Test/NHSpecificTest/SqlConverterAndMultiQuery/Fixture.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using NHibernate.Cfg;
22
using NHibernate.Dialect;
3+
using NHibernate.Util;
34
using NUnit.Framework;
45

56
namespace NHibernate.Test.NHSpecificTest.SqlConverterAndMultiQuery
@@ -16,9 +17,12 @@ protected override void Configure(Configuration configuration)
1617

1718
protected override bool AppliesTo(Dialect.Dialect dialect)
1819
{
19-
// MsSqlCe throws InvalidOperationException instead of a DbException for these tests, preventing
20+
// If prepare_sql is enabled, with most databases prepare will fail with an InvalidOperationException,
21+
// turned into ADOException by prepare code and then not passed to the exception converter.
22+
// MsSqlCe throws InvalidOperationException during Prepare (even when disabled), preventing
2023
// the test SqlConverter to do its job.
21-
return !(Dialect is MsSqlCeDialect);
24+
var prepareSql = PropertiesHelper.GetBoolean(Environment.PrepareSql, cfg.Properties, false);
25+
return !(prepareSql || Dialect is MsSqlCeDialect);
2226
}
2327

2428
[Test]

0 commit comments

Comments
 (0)