diff --git a/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs b/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs index c57c099eb4..ec9dd8a9fe 100644 --- a/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs +++ b/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs @@ -5,19 +5,12 @@ namespace HealthChecks.Redis.Tests.Functional; -public class redis_healthcheck_should : IClassFixture +public class redis_healthcheck_should(RedisContainerFixture redisContainerFixture) : IClassFixture { - private readonly RedisContainerFixture _redisContainerFixture; - - public redis_healthcheck_should(RedisContainerFixture redisContainerFixture) - { - _redisContainerFixture = redisContainerFixture; - } - [Fact] public async Task be_healthy_if_redis_is_available_with_connection_string() { - var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true"; + var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => @@ -43,7 +36,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_string() [Fact] public async Task be_healthy_if_multiple_redis_are_available_with_connection_string() { - var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true"; + var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => @@ -70,7 +63,7 @@ public async Task be_healthy_if_multiple_redis_are_available_with_connection_str [Fact] public async Task be_healthy_if_redis_is_available_with_connection_multiplexer() { - var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true"; + var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true"; var connectionMultiplexer = await ConnectionMultiplexer .ConnectAsync(connectionString); @@ -99,7 +92,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_multiplexer() [Fact] public async Task be_healthy_if_multiple_redis_are_available_with_connection_multiplexer() { - var connectionString = $"{_redisContainerFixture.GetConnectionString()},allowAdmin=true"; + var connectionString = $"{redisContainerFixture.GetConnectionString()},allowAdmin=true"; var connectionMultiplexer = await ConnectionMultiplexer .ConnectAsync(connectionString); diff --git a/test/HealthChecks.Redis.Tests/RedisContainerFixture.cs b/test/HealthChecks.Redis.Tests/RedisContainerFixture.cs index 612d5c64e2..4a20e79079 100644 --- a/test/HealthChecks.Redis.Tests/RedisContainerFixture.cs +++ b/test/HealthChecks.Redis.Tests/RedisContainerFixture.cs @@ -4,6 +4,12 @@ namespace HealthChecks.Redis.Tests; public sealed class RedisContainerFixture : IAsyncLifetime { + public const string Registry = "docker.io"; + + public const string Image = "library/redis"; + + public const string Tag = "7.4"; + public RedisContainer? Container { get; private set; } public string GetConnectionString() => Container?.GetConnectionString() ?? @@ -20,7 +26,7 @@ public async Task DisposeAsync() public static async Task CreateContainerAsync() { var container = new RedisBuilder() - .WithImage($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}") + .WithImage($"{Registry}/{Image}:{Tag}") .Build(); await container.StartAsync(); diff --git a/test/HealthChecks.Redis.Tests/RedisContainerImageTags.cs b/test/HealthChecks.Redis.Tests/RedisContainerImageTags.cs deleted file mode 100644 index d344ad1568..0000000000 --- a/test/HealthChecks.Redis.Tests/RedisContainerImageTags.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace HealthChecks.Redis.Tests; - -internal static class RedisContainerImageTags -{ - public const string Registry = "docker.io"; - - public const string Image = "library/redis"; - - public const string Tag = "7.4"; -}