Skip to content

Commit

Permalink
build(deps): Bump xunit from 2.5.0 to 2.5.1 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Sep 18, 2023
1 parent 505deec commit 2230849
Show file tree
Hide file tree
Showing 21 changed files with 740 additions and 807 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</PropertyGroup>

<PropertyGroup Label="Settings for test projects" Condition=" $(IsTestableProject) ">
<NoWarn>$(NoWarn);CS8604</NoWarn>
<NoWarn>$(NoWarn);CS8604;CA2007;</NoWarn>
</PropertyGroup>

<ItemGroup Condition=" !$(IsTestableProject) ">
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageVersion Include="Testcontainers.Oracle" Version="3.5.0" />
<PackageVersion Include="Testcontainers.PostgreSql" Version="3.5.0" />
<PackageVersion Include="Verify.Xunit" Version="21.1.3" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit" Version="2.5.1" />
<PackageVersion Include="xunit.core" Version="2.5.1" />
<PackageVersion Include="xunit.runner.console" Version="2.5.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,146 +21,137 @@ public class MySqlCheckTests : HealthCheckTestBase, IClassFixture<MySqlDatabase>
[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<ArgumentException>(
"name",
async () =>
_ = await Assert.ThrowsAsync<ArgumentException>(
"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<string, string?>
{
var values = new Dictionary<string, string?>
{
{
"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<string, string?>
{
var values = new Dictionary<string, string?>
{
{
"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<string, string?>
{
var values = new Dictionary<string, string?>
{
{ "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<string, string?>
{
var values = new Dictionary<string, string?>
{
{
"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);
}
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ArgumentNullException>("context", Act).ConfigureAwait(false);
_ = await Assert.ThrowsAsync<ArgumentNullException>("context", Act);
}

[Fact]
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 2230849

Please sign in to comment.