diff --git a/Respawn.UnitTests/RespawnerTests.cs b/Respawn.UnitTests/RespawnerTests.cs deleted file mode 100644 index 0bc14cb..0000000 --- a/Respawn.UnitTests/RespawnerTests.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Threading.Tasks; -using Shouldly; -using Xunit; - -namespace Respawn.UnitTests; - -public class RespawnerTests -{ - [Fact] - public async Task Should_throw_when_adapter_not_SQL() - { - var exception = await Should.ThrowAsync(Respawner.CreateAsync("Server=(LocalDb)\\mssqllocaldb;Database=SqlServerTests;Integrated Security=True", new RespawnerOptions - { - DbAdapter = DbAdapter.MySql - })); - } -} \ No newline at end of file diff --git a/Respawn/Respawn.csproj b/Respawn/Respawn.csproj index b9ae247..e5f0ddb 100644 --- a/Respawn/Respawn.csproj +++ b/Respawn/Respawn.csproj @@ -26,7 +26,6 @@ - diff --git a/Respawn/Respawner.cs b/Respawn/Respawner.cs index e3340ae..b2060a1 100644 --- a/Respawn/Respawner.cs +++ b/Respawn/Respawner.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Data.Common; -using Microsoft.Data.SqlClient; using System.Linq; using System.Threading.Tasks; using Respawn.Graph; @@ -21,34 +20,7 @@ private Respawner(RespawnerOptions options) } /// - /// Creates a based on the supplied options and connection string or name. This overload only supports SQL Server. - /// - /// Name or connection string - /// Options - /// A respawner with generated SQL based on the supplied connection string - /// Throws if the options are any other database adapter besides SQL - public static async Task CreateAsync(string nameOrConnectionString, RespawnerOptions? options = default) - { - options ??= new RespawnerOptions(); - - if (options.DbAdapter is not SqlServerDbAdapter) - { - throw new ArgumentException("This overload only supports the SqlDataAdapter. To use an alternative adapter, use the overload that supplies a DbConnection.", nameof(options.DbAdapter)); - } - - await using var connection = new SqlConnection(nameOrConnectionString); - - await connection.OpenAsync().ConfigureAwait(false); - - var respawner = new Respawner(options); - - await respawner.BuildDeleteTables(connection).ConfigureAwait(false); - - return respawner; - } - - /// - /// Creates a based on the supplied connection and options. + /// Creates a based on the supplied connection and options. /// /// Connection object for your target database /// Options @@ -64,15 +36,6 @@ public static async Task CreateAsync(DbConnection connection, Respawn return respawner; } - public virtual async Task ResetAsync(string nameOrConnectionString) - { - await using var connection = new SqlConnection(nameOrConnectionString); - - await connection.OpenAsync().ConfigureAwait(false); - - await ResetAsync(connection).ConfigureAwait(false); - } - public virtual async Task ResetAsync(DbConnection connection) { if (_temporalTables.Any())