Skip to content

Commit

Permalink
Fixing all teh tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbra committed Feb 1, 2024
1 parent 92424c6 commit ccb0bd1
Show file tree
Hide file tree
Showing 55 changed files with 327 additions and 440 deletions.
3 changes: 1 addition & 2 deletions unittests/Oracle/Database.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.Generic;
using TestCommon.Generic;
using TestCommon.TestInfrastructure;

namespace Oracle;
Expand Down
1 change: 0 additions & 1 deletion unittests/Oracle/MigrationTables.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using grate.Configuration;
using Oracle.TestInfrastructure;
using TestCommon.Generic;
using TestCommon.TestInfrastructure;

Expand Down
3 changes: 1 addition & 2 deletions unittests/Oracle/Running_MigrationScripts/Anytime_scripts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
3 changes: 1 addition & 2 deletions unittests/Oracle/Running_MigrationScripts/DropDatabase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
3 changes: 1 addition & 2 deletions unittests/Oracle/Running_MigrationScripts/Failing_Scripts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
3 changes: 1 addition & 2 deletions unittests/Oracle/Running_MigrationScripts/TokenScripts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Oracle.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace Oracle.Running_MigrationScripts;

Expand Down
1 change: 1 addition & 0 deletions unittests/Oracle/ServiceCollectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using grate.Oracle.Migration;
using Microsoft.Extensions.DependencyInjection;
using Oracle.TestInfrastructure;
using TestCommon.DependencyInjection;
using TestCommon.TestInfrastructure;

namespace Oracle.DependencyInjection;
Expand Down
13 changes: 4 additions & 9 deletions unittests/Oracle/Statement_Splitting/BatchSplitterReplacer_.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FluentAssertions;
using grate.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Oracle.TestInfrastructure;

// ReSharper disable InconsistentNaming
Expand All @@ -20,16 +19,11 @@ public class BatchSplitterReplacer_
// private static BatchSplitterReplacer Replacer => new(Database.StatementSeparatorRegex, StatementSplitter.BatchTerminatorReplacementString);

// ReSharper disable once InconsistentNaming
public class should_replace_on
public class should_replace_on(ITestOutputHelper testOutput, BatchSplitterReplacer replacer)
{
private ITestOutputHelper _testOutput;
private BatchSplitterReplacer Replacer;
private ITestOutputHelper _testOutput = testOutput;
private BatchSplitterReplacer Replacer = replacer;

public should_replace_on(ITestOutputHelper testOutput, BatchSplitterReplacer replacer)
{
_testOutput = testOutput;
Replacer = replacer;
}
[Fact]
public void full_statement_without_issue()
{
Expand Down Expand Up @@ -291,6 +285,7 @@ public should_not_replace_on(ITestOutputHelper testOutput, BatchSplitterReplacer
_testOutput = testOutput;
Replacer = replacer;
}

[Fact]
public void slash_when_slash_is_the_last_part_of_the_last_word_on_a_line()
{
Expand Down
3 changes: 1 addition & 2 deletions unittests/Oracle/Statement_Splitting/StatementSplitter_.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using FluentAssertions;
using grate.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Oracle.TestInfrastructure;

namespace Basic_tests.Infrastructure.Oracle.Statement_Splitting;

Expand All @@ -15,6 +13,7 @@ public StatementSplitter_(StatementSplitter splitter)
{
_splitter = splitter;
}

[Fact]
public void Splits_and_removes_GO_statements()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using grate.Infrastructure;
using grate.Migration;
using grate.Oracle.Migration;
using Microsoft.Extensions.DependencyInjection;
using Oracle.ManagedDataAccess.Client;
using TestCommon.TestInfrastructure;

Expand Down
11 changes: 3 additions & 8 deletions unittests/SqlServer/Database.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using FluentAssertions;
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer;

[Collection(nameof(SqlServerTestContainer))]

public class Database : TestCommon.Generic.GenericDatabase, IClassFixture<SimpleService>
public class Database(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.GenericDatabase(testContext, testOutput)
{
public Database(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}

[Fact]
public async Task Does_not_needlessly_apply_case_sensitive_database_name_checks_Issue_167()
{
Expand Down
11 changes: 3 additions & 8 deletions unittests/SqlServer/MigrationTables.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using SqlServer.TestInfrastructure;
using TestCommon.Generic;
using TestCommon.TestInfrastructure;

namespace SqlServer;

[Collection(nameof(SqlServerTestContainer))]

public class MigrationTables : TestCommon.Generic.GenericMigrationTables, IClassFixture<SimpleService>
public class MigrationTables(IGrateTestContext testContext, ITestOutputHelper testOutput)
: GenericMigrationTables(testContext, testOutput)
{
public MigrationTables(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
protected override string CountTableSql(string schemaName, string tableName)
{
return $@"
Expand Down
14 changes: 4 additions & 10 deletions unittests/SqlServer/Running_MigrationScripts/Anytime_scripts.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class Anytime_scripts : TestCommon.Generic.Running_MigrationScripts.Anytime_scripts, IClassFixture<SimpleService>
{
public Anytime_scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
public class Anytime_scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.Anytime_scripts(testContext, testOutput);

14 changes: 4 additions & 10 deletions unittests/SqlServer/Running_MigrationScripts/DropDatabase.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
public class DropDatabase : TestCommon.Generic.Running_MigrationScripts.DropDatabase, IClassFixture<SimpleService>
{
public DropDatabase(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
// ReSharper disable once InconsistentNaming
public class DropDatabase(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.DropDatabase(testContext, testOutput);
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class Environment_scripts : TestCommon.Generic.Running_MigrationScripts.Environment_scripts, IClassFixture<SimpleService>
{


public Environment_scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
public class Environment_scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.Environment_scripts(testContext, testOutput);
13 changes: 3 additions & 10 deletions unittests/SqlServer/Running_MigrationScripts/Everytime_scripts.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class Everytime_scripts : TestCommon.Generic.Running_MigrationScripts.Everytime_scripts, IClassFixture<SimpleService>
{
public Everytime_scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
public class Everytime_scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.Everytime_scripts(testContext, testOutput);
14 changes: 3 additions & 11 deletions unittests/SqlServer/Running_MigrationScripts/Failing_Scripts.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class Failing_Scripts : TestCommon.Generic.Running_MigrationScripts.Failing_Scripts, IClassFixture<SimpleService>
public class Failing_Scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.Failing_Scripts(testContext, testOutput)
{


public Failing_Scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}

protected override string ExpectedErrorMessageForInvalidSql => "Incorrect syntax near 'TOP'.";
}
15 changes: 3 additions & 12 deletions unittests/SqlServer/Running_MigrationScripts/One_time_scripts.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class One_time_scripts : TestCommon.Generic.Running_MigrationScripts.One_time_scripts, IClassFixture<SimpleService>
{


public One_time_scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
public class One_time_scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.One_time_scripts(testContext, testOutput);
15 changes: 3 additions & 12 deletions unittests/SqlServer/Running_MigrationScripts/Order_Of_Scripts.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]
// ReSharper disable once InconsistentNaming
public class Order_Of_Scripts : TestCommon.Generic.Running_MigrationScripts.Order_Of_Scripts, IClassFixture<SimpleService>
{


public Order_Of_Scripts(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
public class Order_Of_Scripts(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.Order_Of_Scripts(testContext, testOutput);
13 changes: 4 additions & 9 deletions unittests/SqlServer/Running_MigrationScripts/RestoreDatabase.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using Dapper;
using FluentAssertions;
using grate.Configuration;
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;


[Collection(nameof(SqlServerTestContainer))]
public class RestoreDatabase : SqlServerScriptsBase, IClassFixture<SimpleService>
// ReSharper disable once InconsistentNaming
public class RestoreDatabase(IGrateTestContext testContext, ITestOutputHelper testOutput)
: SqlServerScriptsBase(testContext, testOutput)
{


public RestoreDatabase(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}

private readonly string _backupPath = "/var/opt/mssql/backup/test.bak";


Expand Down
17 changes: 4 additions & 13 deletions unittests/SqlServer/Running_MigrationScripts/ScriptsRun_Table.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using SqlServer.TestInfrastructure;
using TestCommon.TestInfrastructure;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

[Collection(nameof(SqlServerTestContainer))]

public class ScriptsRun_Table : TestCommon.Generic.Running_MigrationScripts.ScriptsRun_Table, IClassFixture<SimpleService>
{


public ScriptsRun_Table(SqlServerTestContainer testContainer, SimpleService simpleService, ITestOutputHelper testOutput)
{
Context = new SqlServerGrateTestContext(simpleService.ServiceProvider, testContainer);
TestOutput = testOutput;
}
}
// ReSharper disable once InconsistentNaming
public class ScriptsRun_Table(IGrateTestContext testContext, ITestOutputHelper testOutput)
: TestCommon.Generic.Running_MigrationScripts.ScriptsRun_Table(testContext, testOutput);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using TestCommon.Generic.Running_MigrationScripts;
using TestCommon.TestInfrastructure;

namespace SqlServer.Running_MigrationScripts;

public abstract class SqlServerScriptsBase(IGrateTestContext context, ITestOutputHelper testOutput) :
MigrationsScriptsBase(context, testOutput);

public abstract class SqlServerScriptsBase : MigrationsScriptsBase
{
}
Loading

0 comments on commit ccb0bd1

Please sign in to comment.