Skip to content

Commit 81a1f26

Browse files
committed
Disabled parallelism and made the switch explicit
1 parent 9fe9f4b commit 81a1f26

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

src/Tests/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// The tests use global switches to control Npgsql behaviour so they can't run in parallel
2+
[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)]

src/Tests/DatabaseSupportTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#if !NETCORE
2+
using System;
23
using DbUp.Builder;
34
using DbUp.Tests.Common;
45

@@ -8,6 +9,7 @@ public class DatabaseSupportTests : DatabaseSupportTestsBase
89
{
910
public DatabaseSupportTests() : base()
1011
{
12+
AppContext.SetSwitch("Npgsql.EnableSqlRewriting", true);
1113
}
1214

1315
protected override UpgradeEngineBuilder DeployTo(SupportedDatabases to)

src/Tests/PostgresTableJournalTests.cs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,7 @@ namespace DbUp.Postgresql.Tests;
1111

1212
public class PostgresTableJournalTests : IDisposable
1313
{
14-
[Fact]
15-
public void uses_named_parameters_when_sql_rewriting_not_specified()
16-
{
17-
// Arrange
18-
var dbConnection = Substitute.For<IDbConnection>();
19-
var connectionManager = new TestConnectionManager(dbConnection, true);
20-
var command = Substitute.For<IDbCommand>();
21-
var param1 = Substitute.For<IDbDataParameter>();
22-
var param2 = Substitute.For<IDbDataParameter>();
23-
dbConnection.CreateCommand().Returns(command);
24-
command.CreateParameter().Returns(param1, param2);
25-
command.ExecuteScalar().Returns(x => 0);
26-
var consoleUpgradeLog = new ConsoleUpgradeLog();
27-
var journal = new PostgresqlTableJournal(() => connectionManager, () => consoleUpgradeLog, "public", "SchemaVersions");
28-
29-
// Act
30-
journal.StoreExecutedScript(new SqlScript("test", "select 1"), () => command);
31-
32-
// Assert
33-
command.Received(2).CreateParameter();
34-
param1.ParameterName.ShouldBe("scriptName");
35-
param2.ParameterName.ShouldBe("applied");
36-
command.CommandText.ShouldBe("""insert into "public"."SchemaVersions" (ScriptName, Applied) values (@scriptName, @applied)""");
37-
command.Received().ExecuteNonQuery();
38-
}
39-
40-
[Fact]
14+
[Fact]
4115
public void uses_positional_parameters_when_sql_rewriting_disabled()
4216
{
4317
AppContext.SetSwitch("Npgsql.EnableSqlRewriting", false);

0 commit comments

Comments
 (0)