diff --git a/Directory.Build.props b/Directory.Build.props
index 11157dad..2427d8a8 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,7 +22,7 @@
- $(NoWarn);CS8604
+ $(NoWarn);CS8604;CA2007;
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 331f19ad..13ca1041 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -33,7 +33,7 @@
-
+
diff --git a/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Integration/MySqlCheckTests.cs b/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Integration/MySqlCheckTests.cs
index db1a236d..de5a1a4f 100644
--- a/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Integration/MySqlCheckTests.cs
+++ b/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Integration/MySqlCheckTests.cs
@@ -21,146 +21,137 @@ public class MySqlCheckTests : HealthCheckTestBase, IClassFixture
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnHealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddMySql("TestContainerHealthy")
- .AddMySql("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddMySql("TestContainerHealthy")
+ .AddMySql("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1; DO SLEEP(1);";
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1; DO SLEEP(1);";
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SIGNAL SQLSTATE '45001' SET MESSAGE_TEXT = 'This is a test.';";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command =
+ "SIGNAL SQLSTATE '45001' SET MESSAGE_TEXT = 'This is a test.';";
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:MySqlTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:MySqlTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:MySqlTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:MySqlTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:MySqlTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:MySqlTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Unit/MySqlCheckTests.cs b/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Unit/MySqlCheckTests.cs
index b04595d9..188f5e99 100644
--- a/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Unit/MySqlCheckTests.cs
+++ b/src/HealthChecks.MySql.Connector/tests/NetEvolve.HealthChecks.MySql.Connector.Tests.Unit/MySqlCheckTests.cs
@@ -22,10 +22,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new MySqlCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Integration/MySqlCheckTests.cs b/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Integration/MySqlCheckTests.cs
index 744bd5c1..d8c5a447 100644
--- a/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Integration/MySqlCheckTests.cs
+++ b/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Integration/MySqlCheckTests.cs
@@ -21,146 +21,137 @@ public class MySqlCheckTests : HealthCheckTestBase, IClassFixture
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnHealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddMySql("TestContainerHealthy")
- .AddMySql("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddMySql("TestContainerHealthy")
+ .AddMySql("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1; DO SLEEP(1);";
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1; DO SLEEP(1);";
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddMySql(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SIGNAL SQLSTATE '45001' SET MESSAGE_TEXT = 'This is a test.';";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddMySql(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command =
+ "SIGNAL SQLSTATE '45001' SET MESSAGE_TEXT = 'This is a test.';";
+ }
+ );
+ });
[Fact]
public async Task AddMySql_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:MySqlTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:MySqlTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:MySqlTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:MySqlTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddMySql_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddMySql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddMySql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:MySqlTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:MySqlTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:MySqlTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:MySqlTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Unit/MySqlCheckTests.cs b/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Unit/MySqlCheckTests.cs
index 8cb947e7..4a350914 100644
--- a/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Unit/MySqlCheckTests.cs
+++ b/src/HealthChecks.MySql/tests/NetEvolve.HealthChecks.MySql.Tests.Unit/MySqlCheckTests.cs
@@ -23,10 +23,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new MySqlCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -42,7 +42,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -61,7 +61,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Integration/NpgsqlCheckTests.cs b/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Integration/NpgsqlCheckTests.cs
index 66f97f14..7c836ea1 100644
--- a/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Integration/NpgsqlCheckTests.cs
+++ b/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Integration/NpgsqlCheckTests.cs
@@ -21,145 +21,135 @@ public class NpgsqlCheckTests : HealthCheckTestBase, IClassFixture
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddPostgreSql(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddPostgreSql(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddPostgreSql_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddPostgreSql("TestContainerHealthy")
- .AddPostgreSql("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddPostgreSql("TestContainerHealthy")
+ .AddPostgreSql("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddPostgreSql_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddPostgreSql(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddPostgreSql(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddPostgreSql_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddPostgreSql(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1 = `1`";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddPostgreSql(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1 = `1`";
+ }
+ );
+ });
[Fact]
public async Task AddPostgreSql_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddPostgreSql("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddPostgreSql("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:PostgreSqlTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:PostgreSqlTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddPostgreSql_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddPostgreSql("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddPostgreSql("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:PostgreSqlTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:PostgreSqlTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:PostgreSqlTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:PostgreSqlTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddPostgreSql_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddPostgreSql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddPostgreSql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:PostgreSqlTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:PostgreSqlTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddPostgreSql_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddPostgreSql("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddPostgreSql("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:PostgreSqlTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:PostgreSqlTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:PostgreSqlTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:PostgreSqlTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Unit/NpgsqlCheckTests.cs b/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Unit/NpgsqlCheckTests.cs
index ae587b31..787876eb 100644
--- a/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Unit/NpgsqlCheckTests.cs
+++ b/src/HealthChecks.Npgsql/tests/NetEvolve.HealthChecks.Npgsql.Tests.Unit/NpgsqlCheckTests.cs
@@ -22,10 +22,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new NpgsqlCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Integration/OracleCheckTests.cs b/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Integration/OracleCheckTests.cs
index 22d160f0..74557053 100644
--- a/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Integration/OracleCheckTests.cs
+++ b/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Integration/OracleCheckTests.cs
@@ -21,145 +21,135 @@ public class OracleCheckTests : HealthCheckTestBase, IClassFixture
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddOracle(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.GetConnectionString();
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddOracle(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.GetConnectionString();
+ }
+ );
+ });
[Fact]
public async Task AddOracle_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddOracle("TestContainerHealthy")
- .AddOracle("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddOracle("TestContainerHealthy")
+ .AddOracle("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddOracle_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddOracle(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.GetConnectionString();
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddOracle(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.GetConnectionString();
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddOracle_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddOracle(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.GetConnectionString();
- options.Command = "SELECT 1 = `1`;";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddOracle(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.GetConnectionString();
+ options.Command = "SELECT 1 = `1`;";
+ }
+ );
+ });
[Fact]
public async Task AddOracle_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddOracle("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddOracle("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:OracleTestContainerHealthy:ConnectionString",
- _database.GetConnectionString()
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:OracleTestContainerHealthy:ConnectionString",
+ _database.GetConnectionString()
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddOracle_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddOracle("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddOracle("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:OracleTestContainerDegraded:ConnectionString",
- _database.GetConnectionString()
- },
- { "HealthChecks:OracleTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:OracleTestContainerDegraded:ConnectionString",
+ _database.GetConnectionString()
+ },
+ { "HealthChecks:OracleTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddOracle_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddOracle("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddOracle("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:OracleTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:OracleTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddOracle_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddOracle("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddOracle("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:OracleTestNoValues:ConnectionString",
- _database.GetConnectionString()
- },
- { "HealthChecks:OracleTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:OracleTestNoValues:ConnectionString",
+ _database.GetConnectionString()
+ },
+ { "HealthChecks:OracleTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Unit/OracleCheckTests.cs b/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Unit/OracleCheckTests.cs
index 97746f53..4f795566 100644
--- a/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Unit/OracleCheckTests.cs
+++ b/src/HealthChecks.Oracle/tests/NetEvolve.HealthChecks.Oracle.Tests.Unit/OracleCheckTests.cs
@@ -23,10 +23,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new OracleCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -42,7 +42,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -61,7 +61,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Integration/SQLiteCheckTests.cs b/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Integration/SQLiteCheckTests.cs
index 5664597c..df33693a 100644
--- a/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Integration/SQLiteCheckTests.cs
+++ b/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Integration/SQLiteCheckTests.cs
@@ -22,146 +22,136 @@ public class SQLiteCheckTests : HealthCheckTestBase, IClassFixture
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSQLite(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSQLite(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddSQLite_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddSQLite("TestContainerHealthy")
- .AddSQLite("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddSQLite("TestContainerHealthy")
+ .AddSQLite("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddSQLite_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSQLite(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSQLite(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddSQLite_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSQLite(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1 = `1`";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSQLite(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1 = `1`";
+ }
+ );
+ });
[Fact]
public async Task AddSQLite_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSQLite("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSQLite("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SQLiteTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SQLiteTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSQLite_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSQLite("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSQLite("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SQLiteTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SQLiteTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SQLiteTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SQLiteTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSQLite_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSQLite("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSQLite("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:SQLiteTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:SQLiteTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSQLite_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSQLite("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSQLite("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SQLiteTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SQLiteTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SQLiteTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SQLiteTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Unit/SQLiteCheckTests.cs b/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Unit/SQLiteCheckTests.cs
index 371038ed..8a277627 100644
--- a/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Unit/SQLiteCheckTests.cs
+++ b/src/HealthChecks.SQLite/tests/NetEvolve.HealthChecks.SQLite.Tests.Unit/SQLiteCheckTests.cs
@@ -22,10 +22,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new SQLiteCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Integration/SqlServerLegacyCheckTests.cs b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Integration/SqlServerLegacyCheckTests.cs
index e5b74ff0..64435aca 100644
--- a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Integration/SqlServerLegacyCheckTests.cs
+++ b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Integration/SqlServerLegacyCheckTests.cs
@@ -21,146 +21,136 @@ public class SqlServerLegacyCheckTests : HealthCheckTestBase, IClassFixture
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServerLegacy(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddSqlServerLegacy_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddSqlServerLegacy("TestContainerHealthy")
- .AddSqlServerLegacy("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddSqlServerLegacy("TestContainerHealthy")
+ .AddSqlServerLegacy("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddSqlServerLegacy_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServerLegacy(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddSqlServerLegacy_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "RAISERROR('This is a test.',16,1)";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServerLegacy(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "RAISERROR('This is a test.',16,1)";
+ }
+ );
+ });
[Fact]
public async Task AddSqlServerLegacy_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServerLegacy("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServerLegacy_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServerLegacy("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SqlServerTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SqlServerTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServerLegacy_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServerLegacy("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:SqlServerTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:SqlServerTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServerLegacy_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServerLegacy("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServerLegacy("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SqlServerTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SqlServerTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerCheckTests.cs b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerCheckTests.cs
index 76832079..96528b3e 100644
--- a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerCheckTests.cs
+++ b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerCheckTests.cs
@@ -22,10 +22,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new SqlServerLegacyCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerOptionsConfigureTests.cs b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerOptionsConfigureTests.cs
index 3dba4c1d..0bd83303 100644
--- a/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerOptionsConfigureTests.cs
+++ b/src/HealthChecks.SqlServer.Legacy/tests/NetEvolve.HealthChecks.SqlServer.Legacy.Tests.Unit/SqlServerOptionsConfigureTests.cs
@@ -116,7 +116,11 @@ public void PostConfigure_WhenNameIsNull_DoNothing()
// Arrange
var configure = new SqlServerLegacyConfigure(new ConfigurationBuilder().Build());
var name = default(string);
- var options = new SqlServerLegacyOptions { ConnectionString = "Test", Command = string.Empty };
+ var options = new SqlServerLegacyOptions
+ {
+ ConnectionString = "Test",
+ Command = string.Empty
+ };
// Act
configure.PostConfigure(name, options);
diff --git a/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Integration/SqlServerCheckTests.cs b/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Integration/SqlServerCheckTests.cs
index 30dfb734..c005465f 100644
--- a/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Integration/SqlServerCheckTests.cs
+++ b/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Integration/SqlServerCheckTests.cs
@@ -21,146 +21,136 @@ public class SqlServerCheckTests : HealthCheckTestBase, IClassFixture
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServer(
- "TestContainerHealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServer(
+ "TestContainerHealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ }
+ );
+ });
[Fact]
public async Task AddSqlServer_UseOptionsDoubleRegistered_ShouldReturnHealthy() =>
- _ = await Assert
- .ThrowsAsync(
- "name",
- async () =>
+ _ = await Assert.ThrowsAsync(
+ "name",
+ async () =>
+ {
+ await RunAndVerify(healthChecks =>
{
- await RunAndVerify(healthChecks =>
- {
- _ = healthChecks
- .AddSqlServer("TestContainerHealthy")
- .AddSqlServer("TestContainerHealthy");
- })
- .ConfigureAwait(false);
- }
- )
- .ConfigureAwait(false);
+ _ = healthChecks
+ .AddSqlServer("TestContainerHealthy")
+ .AddSqlServer("TestContainerHealthy");
+ });
+ }
+ );
[Fact]
public async Task AddSqlServer_UseOptions_ShouldReturnDegraded() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServer(
- "TestContainerDegraded",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
- options.Timeout = 0;
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServer(
+ "TestContainerDegraded",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "SELECT 1; WAITFOR DELAY '00:00:00.100';";
+ options.Timeout = 0;
+ }
+ );
+ });
[Fact]
public async Task AddSqlServer_UseOptions_ShouldReturnUnhealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddSqlServer(
- "TestContainerUnhealthy",
- options =>
- {
- options.ConnectionString = _database.ConnectionString;
- options.Command = "RAISERROR('This is a test.',16,1)";
- }
- );
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddSqlServer(
+ "TestContainerUnhealthy",
+ options =>
+ {
+ options.ConnectionString = _database.ConnectionString;
+ options.Command = "RAISERROR('This is a test.',16,1)";
+ }
+ );
+ });
[Fact]
public async Task AddSqlServer_UseConfiguration_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServer("TestContainerHealthy");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServer("TestContainerHealthy");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestContainerHealthy:ConnectionString",
- _database.ConnectionString
- }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestContainerHealthy:ConnectionString",
+ _database.ConnectionString
+ }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServer_UseConfiguration_ShouldReturnDegraded() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServer("TestContainerDegraded");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServer("TestContainerDegraded");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestContainerDegraded:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SqlServerTestContainerDegraded:Timeout", "0" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestContainerDegraded:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SqlServerTestContainerDegraded:Timeout", "0" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServer_UseConfigration_ConnectionStringEmpty_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServer("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServer("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
- {
- { "HealthChecks:SqlServerTestNoValues:ConnectionString", "" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ { "HealthChecks:SqlServerTestNoValues:ConnectionString", "" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
[Fact]
public async Task AddSqlServer_UseConfigration_TimeoutMinusTwo_ThrowException() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddSqlServer("TestNoValues");
- },
- config =>
+ healthChecks =>
+ {
+ _ = healthChecks.AddSqlServer("TestNoValues");
+ },
+ config =>
+ {
+ var values = new Dictionary
{
- var values = new Dictionary
{
- {
- "HealthChecks:SqlServerTestNoValues:ConnectionString",
- _database.ConnectionString
- },
- { "HealthChecks:SqlServerTestNoValues:Timeout", "-2" }
- };
- _ = config.AddInMemoryCollection(values);
- }
- )
- .ConfigureAwait(false);
+ "HealthChecks:SqlServerTestNoValues:ConnectionString",
+ _database.ConnectionString
+ },
+ { "HealthChecks:SqlServerTestNoValues:Timeout", "-2" }
+ };
+ _ = config.AddInMemoryCollection(values);
+ }
+ );
}
diff --git a/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Unit/SqlServerCheckTests.cs b/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Unit/SqlServerCheckTests.cs
index 4635c412..a8807d35 100644
--- a/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Unit/SqlServerCheckTests.cs
+++ b/src/HealthChecks.SqlServer/tests/NetEvolve.HealthChecks.SqlServer.Tests.Unit/SqlServerCheckTests.cs
@@ -22,10 +22,10 @@ public async Task CheckHealthAsync_WhenContextNull_ThrowArgumentNullException()
var check = new SqlServerCheck(optionsMonitor);
// Act
- async Task Act() => _ = await check.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => _ = await check.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenCancellationTokenIsCancelled_ShouldReturn
var cancellationToken = new CancellationToken(true);
// Act
- var result = await check.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenOptionsAreNull_ShouldReturnUnhealthy()
};
// Act
- var result = await check.CheckHealthAsync(context).ConfigureAwait(false);
+ var result = await check.CheckHealthAsync(context);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
diff --git a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationHealthyCheckTests.cs b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationHealthyCheckTests.cs
index 6b0965d4..faf1fe78 100644
--- a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationHealthyCheckTests.cs
+++ b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationHealthyCheckTests.cs
@@ -15,8 +15,7 @@ public class ApplicationHealthyCheckTests : HealthCheckTestBase
[Fact]
public async Task AddApplicationHealthy_ShouldReturnHealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddApplicationHealthy();
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddApplicationHealthy();
+ });
}
diff --git a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationReadyCheckTests.cs b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationReadyCheckTests.cs
index 0a169fbb..5d2cd5bb 100644
--- a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationReadyCheckTests.cs
+++ b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Integration/ApplicationReadyCheckTests.cs
@@ -16,23 +16,21 @@ public class ApplicationReadyCheckTests : HealthCheckTestBase
[Fact]
public async Task AddApplicationReady_ShouldReturnHealthy() =>
await RunAndVerify(healthChecks =>
- {
- _ = healthChecks.AddApplicationReady();
- })
- .ConfigureAwait(false);
+ {
+ _ = healthChecks.AddApplicationReady();
+ });
[Fact]
public async Task AddApplicationReady_WithCustomName_ShouldReturnHealthy() =>
await RunAndVerify(
- healthChecks =>
- {
- _ = healthChecks.AddApplicationReady();
- },
- serverConfiguration: server =>
- {
- var lifetime = server.Services.GetRequiredService();
- lifetime.StopApplication();
- }
- )
- .ConfigureAwait(false);
+ healthChecks =>
+ {
+ _ = healthChecks.AddApplicationReady();
+ },
+ serverConfiguration: server =>
+ {
+ var lifetime = server.Services.GetRequiredService();
+ lifetime.StopApplication();
+ }
+ );
}
diff --git a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationReadinessCheckTests.cs b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationReadinessCheckTests.cs
index 20974f45..f62a6c27 100644
--- a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationReadinessCheckTests.cs
+++ b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationReadinessCheckTests.cs
@@ -21,10 +21,10 @@ public async Task CheckHealthAsync_WhenArgumentContextNull_ThrowException()
var sut = new ApplicationReadyCheck(lifetime);
// Act
- async Task Act() => await sut.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => await sut.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -41,7 +41,7 @@ public async Task CheckHealthAsync_WhenArgumentCancellationToken_ReturnsHealthy(
// Act
lifetime.StartApplication();
- var result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await sut.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Healthy, result.Status);
@@ -60,7 +60,7 @@ public async Task CheckHealthAsync_WhenArgumentCancellationTokenIsCancelled_Retu
};
// Act
- var result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await sut.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);
@@ -82,11 +82,11 @@ public async Task CheckHealthAsync_WhenApplicationStopped_ReturnsUnhealthy()
lifetime.StartApplication();
// Assert
- var result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await sut.CheckHealthAsync(context, cancellationToken);
Assert.Equal(HealthStatus.Healthy, result.Status);
lifetime.StopApplication();
- result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ result = await sut.CheckHealthAsync(context, cancellationToken);
Assert.Equal(HealthStatus.Unhealthy, result.Status);
}
diff --git a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationSelfCheckTests.cs b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationSelfCheckTests.cs
index 52c84dc9..f31bc4f6 100644
--- a/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationSelfCheckTests.cs
+++ b/src/HealthChecks/tests/NetEvolve.HealthChecks.Tests.Unit/ApplicationSelfCheckTests.cs
@@ -19,10 +19,10 @@ public async Task CheckHealthAsync_WhenArgumentContextNull_ThrowException()
var sut = new ApplicationHealthyCheck();
// Act
- async Task Act() => await sut.CheckHealthAsync(null!).ConfigureAwait(false);
+ async Task Act() => await sut.CheckHealthAsync(null!);
// Assert
- _ = await Assert.ThrowsAsync("context", Act).ConfigureAwait(false);
+ _ = await Assert.ThrowsAsync("context", Act);
}
[Fact]
@@ -37,7 +37,7 @@ public async Task CheckHealthAsync_WhenArgumentCancellationToken_ReturnsHealthy(
};
// Act
- var result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await sut.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Healthy, result.Status);
@@ -55,7 +55,7 @@ public async Task CheckHealthAsync_WhenArgumentCancellationTokenIsCancelled_Retu
};
// Act
- var result = await sut.CheckHealthAsync(context, cancellationToken).ConfigureAwait(false);
+ var result = await sut.CheckHealthAsync(context, cancellationToken);
// Assert
Assert.Equal(HealthStatus.Unhealthy, result.Status);