Skip to content

Commit

Permalink
Downgrade to "netstandard2.0"
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-carvalho committed May 15, 2024
1 parent 2ad376d commit dc8e780
Show file tree
Hide file tree
Showing 8 changed files with 803 additions and 805 deletions.
2 changes: 1 addition & 1 deletion Respawn.DatabaseTests/EmptyDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task InitializeAsync()
{
var connString = @"Server=(LocalDb)\mssqllocaldb;Database=tempdb;Integrated Security=True";

await using (var connection = new SqlConnection(connString))
using (var connection = new SqlConnection(connString))
{
await connection.OpenAsync();
using (var database = new Database(connection))
Expand Down
28 changes: 14 additions & 14 deletions Respawn.DatabaseTests/InformixTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public async Task InitializeAsync()
{
const string connString = "Server=127.0.0.1:9089;Database=sysadmin;UID=informix;PWD=in4mix;Persist Security Info=True;Authentication=Server;";

await using (var connection = new DB2Connection(connString))
using (var connection = new DB2Connection(connString))
{
await connection.OpenAsync();

using var database = new Database(connection);

_databaseName = $"dummyifx_{Guid.NewGuid():N}";
Expand All @@ -57,7 +57,7 @@ public async Task InitializeAsync()
[SkipOnCI]
public async Task ShouldDeleteData()
{
await using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT);", _connection);
using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT);", _connection);

command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Foo VALUES (?)";
Expand All @@ -84,7 +84,7 @@ public async Task ShouldDeleteData()
[SkipOnCI]
public async Task ShouldIgnoreTables()
{
await using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT);", _connection);
using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT);", _connection);
command.ExecuteNonQuery();
command.CommandText = "DROP TABLE IF EXISTS Bar; CREATE TABLE Bar (Value INT);";
command.ExecuteNonQuery();
Expand Down Expand Up @@ -114,9 +114,9 @@ public async Task ShouldIgnoreTables()
[SkipOnCI]
public async Task ShouldHandleRelationships()
{
await using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT PRIMARY KEY);", _connection);
using var command = new DB2Command("DROP TABLE IF EXISTS Foo; CREATE TABLE Foo (Value INT PRIMARY KEY);", _connection);
command.ExecuteNonQuery();
command.CommandText = @"DROP TABLE IF EXISTS Bar;
command.CommandText = @"DROP TABLE IF EXISTS Bar;
CREATE TABLE Bar (
Value INT,
FooValue INT,
Expand Down Expand Up @@ -162,13 +162,13 @@ FOREIGN KEY (FooValue) REFERENCES Foo(Value)
[SkipOnCI]
public async Task ShouldHandleCircularRelationships()
{
await using var command = new DB2Command(@"DROP TABLE IF EXISTS Parent;
using var command = new DB2Command(@"DROP TABLE IF EXISTS Parent;
CREATE TABLE Parent (
Id INT PRIMARY KEY,
ChildId INT NULL
);", _connection);
command.ExecuteNonQuery();
command.CommandText = @"DROP TABLE IF EXISTS Child;
command.CommandText = @"DROP TABLE IF EXISTS Child;
CREATE TABLE Child (
Id INT PRIMARY KEY,
ParentId INT NULL
Expand Down Expand Up @@ -225,7 +225,7 @@ ParentId INT NULL
[SkipOnCI]
public async Task ShouldHandleSelfRelationships()
{
await using var command = new DB2Command(@"DROP TABLE IF EXISTS Foo;
using var command = new DB2Command(@"DROP TABLE IF EXISTS Foo;
CREATE TABLE Foo (
Id INT PRIMARY KEY,
ParentId INT NULL
Expand Down Expand Up @@ -271,7 +271,7 @@ ParentId INT NULL
[SkipOnCI]
public async Task ShouldHandleComplexCycles()
{
await using var command = new DB2Command("DROP TABLE IF EXISTS A; CREATE TABLE A (Id INT PRIMARY KEY, B_Id INT NULL)", _connection);
using var command = new DB2Command("DROP TABLE IF EXISTS A; CREATE TABLE A (Id INT PRIMARY KEY, B_Id INT NULL)", _connection);
command.ExecuteNonQuery();
command.CommandText = "DROP TABLE IF EXISTS B; CREATE TABLE B (Id INT PRIMARY KEY, A_Id INT NULL, C_Id INT NULL, D_Id INT NULL)";
command.ExecuteNonQuery();
Expand Down Expand Up @@ -366,7 +366,7 @@ public async Task ShouldExcludeSchemas()

await ManageUser(user_1);
await ManageUser(user_2);
await using var command = new DB2Command($"DROP TABLE IF EXISTS {user_1}.Foo; CREATE TABLE {user_1}.Foo (Value INT)", _connection);
using var command = new DB2Command($"DROP TABLE IF EXISTS {user_1}.Foo; CREATE TABLE {user_1}.Foo (Value INT)", _connection);
command.ExecuteNonQuery();
command.CommandText = $"DROP TABLE IF EXISTS {user_2}.Bar; CREATE TABLE {user_2}.Bar (Value INT)";
command.ExecuteNonQuery();
Expand Down Expand Up @@ -410,7 +410,7 @@ public async Task ShouldIncludeSchemas()

await ManageUser(user_1);
await ManageUser(user_2);
await using var command = new DB2Command($"DROP TABLE IF EXISTS {user_1}.Fooo; CREATE TABLE {user_1}.Fooo (Value INT)", _connection);
using var command = new DB2Command($"DROP TABLE IF EXISTS {user_1}.Fooo; CREATE TABLE {user_1}.Fooo (Value INT)", _connection);
command.ExecuteNonQuery();
command.CommandText = $"DROP TABLE IF EXISTS {user_2}.Baar; CREATE TABLE {user_2}.Baar (Value INT)";
command.ExecuteNonQuery();
Expand Down Expand Up @@ -448,10 +448,10 @@ public async Task ShouldIncludeSchemas()

private async Task ManageUser(string userName)
{
await using var connection = new DB2Connection($"Server=127.0.0.1:9089;Database={_databaseName};UID=informix;PWD=in4mix;Persist Security Info=True;Authentication=Server;");
using var connection = new DB2Connection($"Server=127.0.0.1:9089;Database={_databaseName};UID=informix;PWD=in4mix;Persist Security Info=True;Authentication=Server;");
await connection.OpenAsync();

//await using var allUsers = new DB2Command("SELECT username FROM sysusers", connection);
//using var allUsers = new DB2Command("SELECT username FROM sysusers", connection);
var database = new Database(connection);

await database.ExecuteAsync($"DROP USER {userName};");
Expand Down
4 changes: 2 additions & 2 deletions Respawn.DatabaseTests/PostgresTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public async Task InitializeAsync()
dbConnString = "Server=127.0.0.1;Port=5432;User ID=postgres;Password=root;database={0}";
}
var dbName = DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N");
await using (var connection = new NpgsqlConnection(rootConnString))
using (var connection = new NpgsqlConnection(rootConnString))
{
connection.Open();

await using (var cmd = connection.CreateCommand())
using (var cmd = connection.CreateCommand())
{
cmd.CommandText = "create database \"" + dbName + "\"";
await cmd.ExecuteNonQueryAsync();
Expand Down
Loading

0 comments on commit dc8e780

Please sign in to comment.