public async Task LoggingHealthCheckPublisher_Should_Execute()
        {
            var loggerHelper = new XunitTestOutputHelper();

            var host = new HostBuilder()
                       .ConfigureLogging(loggerBuilder =>
            {
                loggerBuilder.AddXunit(_output, LogLevel.Debug);
                loggerBuilder.AddXunit(loggerHelper, LogLevel.Debug);
            })
                       .ConfigureServices(services =>
            {
                services.Configure <HealthCheckPublisherOptions>(options =>
                {
                    options.Delay   = TimeSpan.FromSeconds(1);
                    options.Period  = TimeSpan.FromSeconds(1);
                    options.Timeout = TimeSpan.FromSeconds(1);
                });

                services.AddHealthChecks()
                .AddCheck("Degraded_Check", () => HealthCheckResult.Degraded())
                .AddCheck("Unhealthy_Check", () => HealthCheckResult.Unhealthy())
                .AddLoggerPublisher();
            }).Build();

            await host.StartAsync();

            await Task.Delay(TimeSpan.FromSeconds(2));

            Assert.Contains("Degraded_Check", loggerHelper.Output);
            Assert.Contains("Unhealthy_Check", loggerHelper.Output);

            await host.StopAsync();
        }
        public async Task SocketHealthPublisher_Should_Execute()
        {
            var loggerHelper = new XunitTestOutputHelper();

            var port = 8080;

            var host = new HostBuilder()
                       .ConfigureLogging(loggerBuilder =>
            {
                loggerBuilder.AddXunit(_output, LogLevel.Debug);
                loggerBuilder.AddXunit(loggerHelper, LogLevel.Debug);
            })
                       .ConfigureServices(services =>
            {
                services.Configure <HealthCheckPublisherOptions>(options =>
                {
                    options.Delay   = TimeSpan.FromSeconds(1);
                    options.Period  = TimeSpan.FromSeconds(2);
                    options.Timeout = TimeSpan.FromSeconds(2);
                });

                services.AddHealthChecks()
                .AddCheck("Healthy_Check_One", () => HealthCheckResult.Healthy())
                .AddCheck("Healthy_Check_Two", () => HealthCheckResult.Healthy())
                .AddSocketListener(port)
                .AddLoggerPublisher();
            }).Build();

            await host.StartAsync();

            await Task.Delay(TimeSpan.FromSeconds(1));

            var response1 = TcpClientResponse(port, "ping");

            Assert.Equal("ping", response1);

            var response2 = TcpClientResponse(port, "ping2");

            Assert.Equal("ping2", response2);

            await Task.Delay(TimeSpan.FromSeconds(4));

            await host.StopAsync();
        }