diff --git a/README.md b/README.md index d53c0e8e63..c59cf004f7 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ public void ConfigureServices(IServiceCollection services) healthQuery: "SELECT 1;", name: "sql", failureStatus: HealthStatus.Degraded, - tags: new string[] { "db", "sql", "sqlserver" }); + tags: ["db", "sql", "sqlserver"]); } ``` diff --git a/samples/HealthChecks.UI.Branding/Startup.cs b/samples/HealthChecks.UI.Branding/Startup.cs index 4a76026c52..a59c0f432c 100644 --- a/samples/HealthChecks.UI.Branding/Startup.cs +++ b/samples/HealthChecks.UI.Branding/Startup.cs @@ -16,9 +16,9 @@ public void ConfigureServices(IServiceCollection services) services //.AddDemoAuthentication() .AddHealthChecks() - .AddProcessAllocatedMemoryHealthCheck(maximumMegabytesAllocated: 100, tags: new[] { "process", "memory" }) - .AddCheck("random1", tags: new[] { "random" }) - .AddCheck("random2", tags: new[] { "random" }) + .AddProcessAllocatedMemoryHealthCheck(maximumMegabytesAllocated: 100, tags: ["process", "memory"]) + .AddCheck("random1", tags: ["random"]) + .AddCheck("random2", tags: ["random"]) .Services .AddHealthChecksUI(setupSettings: setup => { diff --git a/samples/HealthChecks.UI.StorageProviders/Startup.cs b/samples/HealthChecks.UI.StorageProviders/Startup.cs index bd2c1acbd5..8793ed13d9 100644 --- a/samples/HealthChecks.UI.StorageProviders/Startup.cs +++ b/samples/HealthChecks.UI.StorageProviders/Startup.cs @@ -19,7 +19,7 @@ public void ConfigureServices(IServiceCollection services) services .AddRouting() .AddHealthChecks() - .AddProcessAllocatedMemoryHealthCheck(maximumMegabytesAllocated: 200, tags: new[] { "memory" }) + .AddProcessAllocatedMemoryHealthCheck(maximumMegabytesAllocated: 200, tags: ["memory"]) .AddCheck(name: "random", () => DateTime.UtcNow.Second % 2 == 0 ? HealthCheckResult.Healthy() : HealthCheckResult.Unhealthy()) .Services .AddHealthChecksUI(setup => diff --git a/src/HealthChecks.Aws.Sns/README.md b/src/HealthChecks.Aws.Sns/README.md index 22848fd33b..264cd71680 100644 --- a/src/HealthChecks.Aws.Sns/README.md +++ b/src/HealthChecks.Aws.Sns/README.md @@ -80,7 +80,7 @@ public void ConfigureServices(IServiceCollection services) .AddHealthChecks() .AddSnsSubscriptions(options => { - options.AddTopicAndSubscriptions("topicName", new string[] { "subscription1-arn", "subscription2-arn" }); + options.AddTopicAndSubscriptions("topicName", ["subscription1-arn", "subscription2-arn"]); }); } ``` @@ -94,7 +94,7 @@ public void ConfigureServices(IServiceCollection services) .AddHealthChecks() .AddSnsSubscriptions(options => { - options.AddTopicAndSubscriptions("topicName", new string[] { "subscription1-arn", "subscription2-arn" }); + options.AddTopicAndSubscriptions("topicName", ["subscription1-arn", "subscription2-arn"]); options.Credentials = new BasicAWSCredentials("access-key", "secret-key"); }); } @@ -109,7 +109,7 @@ public void ConfigureServices(IServiceCollection services) .AddHealthChecks() .AddSnsSubscriptions(options => { - options.AddTopicAndSubscriptions("topicName", new string[] { "subscription1-arn", "subscription2-arn" }); + options.AddTopicAndSubscriptions("topicName", ["subscription1-arn", "subscription2-arn"]); options.RegionEndpoint = RegionEndpoint.EUCentral1; }); } @@ -124,7 +124,7 @@ public void ConfigureServices(IServiceCollection services) .AddHealthChecks() .AddSnsSubscriptions(options => { - options.AddTopicAndSubscriptions("topicName", new string[] { "subscription1-arn", "subscription2-arn" }); + options.AddTopicAndSubscriptions("topicName", ["subscription1-arn", "subscription2-arn"]); options.Credentials = new BasicAWSCredentials("access-key", "secret-key"); options.RegionEndpoint = RegionEndpoint.EUCentral1; }); diff --git a/src/HealthChecks.Aws.Sns/SnsOptions.cs b/src/HealthChecks.Aws.Sns/SnsOptions.cs index a5448e4ff5..793988566b 100644 --- a/src/HealthChecks.Aws.Sns/SnsOptions.cs +++ b/src/HealthChecks.Aws.Sns/SnsOptions.cs @@ -24,7 +24,7 @@ public SnsOptions AddTopicAndSubscriptions(string topicName, IEnumerable { if (!TopicsAndSubscriptions.TryGetValue(topicName, out var subs)) { - TopicsAndSubscriptions.Add(topicName, subs = new List(subscriptions ?? Array.Empty())); + TopicsAndSubscriptions.Add(topicName, subs = new List(subscriptions ?? [])); } else if (subscriptions != null) { diff --git a/src/HealthChecks.AzureApplicationInsights/AzureApplicationInsightsHealthCheck.cs b/src/HealthChecks.AzureApplicationInsights/AzureApplicationInsightsHealthCheck.cs index c3c555c150..0a2aa28144 100644 --- a/src/HealthChecks.AzureApplicationInsights/AzureApplicationInsightsHealthCheck.cs +++ b/src/HealthChecks.AzureApplicationInsights/AzureApplicationInsightsHealthCheck.cs @@ -7,11 +7,11 @@ public class AzureApplicationInsightsHealthCheck : IHealthCheck { // from https://docs.microsoft.com/en-us/azure/azure-monitor/app/ip-addresses#outgoing-ports private readonly string[] _appInsightsUrls = - { + [ "https://dc.applicationinsights.azure.com", "https://dc.applicationinsights.microsoft.com", "https://dc.services.visualstudio.com" - }; + ]; private readonly string _instrumentationKey; private readonly IHttpClientFactory _httpClientFactory; diff --git a/src/HealthChecks.AzureDigitalTwin/README.md b/src/HealthChecks.AzureDigitalTwin/README.md index 7a06dca25a..4427d28ab6 100644 --- a/src/HealthChecks.AzureDigitalTwin/README.md +++ b/src/HealthChecks.AzureDigitalTwin/README.md @@ -98,7 +98,7 @@ public void ConfigureServices(IServiceCollection services) "MyDigitalTwinClientSecret", "TenantId", "https://my-awesome-dt-host", - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }) + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"]) } ``` @@ -112,7 +112,7 @@ public void ConfigureServices(IServiceCollection services) .AddHealthChecks() .AddAzureDigitalTwinModels( myCredentials, - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }, + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"], failureStatus: HealthStatus.Degraded) } ``` diff --git a/src/HealthChecks.Network/FtpHealthCheck.cs b/src/HealthChecks.Network/FtpHealthCheck.cs index 61f570edb2..45347d6af0 100644 --- a/src/HealthChecks.Network/FtpHealthCheck.cs +++ b/src/HealthChecks.Network/FtpHealthCheck.cs @@ -62,7 +62,7 @@ private WebRequest CreateFtpWebRequest(string host, bool createFile = false, Net ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; using var stream = ftpRequest.GetRequestStream(); - stream.Write(new byte[] { 0x0 }, 0, 1); + stream.Write([0x0], 0, 1); } else { diff --git a/src/HealthChecks.Network/SftpHealthCheck.cs b/src/HealthChecks.Network/SftpHealthCheck.cs index 06f445daeb..0cbe792cf6 100644 --- a/src/HealthChecks.Network/SftpHealthCheck.cs +++ b/src/HealthChecks.Network/SftpHealthCheck.cs @@ -37,7 +37,7 @@ public Task CheckHealthAsync(HealthCheckContext context, Canc { if (item.FileCreationOptions.createFile) { - using var stream = new MemoryStream(new byte[] { 0x0 }, 0, 1); + using var stream = new MemoryStream([0x0], 0, 1); sftpClient.UploadFile(stream, item.FileCreationOptions.remoteFilePath); } } diff --git a/src/HealthChecks.OpenIdConnectServer/OidcConstants.cs b/src/HealthChecks.OpenIdConnectServer/OidcConstants.cs index 8df2c8fdab..77a60cdbb3 100644 --- a/src/HealthChecks.OpenIdConnectServer/OidcConstants.cs +++ b/src/HealthChecks.OpenIdConnectServer/OidcConstants.cs @@ -14,11 +14,11 @@ internal class OidcConstants internal const string ALGORITHMS_SUPPORTED = "id_token_signing_alg_values_supported"; - internal static string[] REQUIRED_RESPONSE_TYPES => new[] { "code", "id_token" }; + internal static string[] REQUIRED_RESPONSE_TYPES => ["code", "id_token"]; - internal static string[] REQUIRED_COMBINED_RESPONSE_TYPES => new[] { "token id_token", "id_token token" }; + internal static string[] REQUIRED_COMBINED_RESPONSE_TYPES => ["token id_token", "id_token token"]; - internal static string[] REQUIRED_SUBJECT_TYPES => new[] { "pairwise", "public" }; + internal static string[] REQUIRED_SUBJECT_TYPES => ["pairwise", "public"]; - internal static string[] REQUIRED_ALGORITHMS => new[] { "RS256" }; + internal static string[] REQUIRED_ALGORITHMS => ["RS256"]; } diff --git a/src/HealthChecks.Prometheus.Metrics/LivenessPrometheusMetrics.cs b/src/HealthChecks.Prometheus.Metrics/LivenessPrometheusMetrics.cs index 13b646090e..f463fb4e79 100644 --- a/src/HealthChecks.Prometheus.Metrics/LivenessPrometheusMetrics.cs +++ b/src/HealthChecks.Prometheus.Metrics/LivenessPrometheusMetrics.cs @@ -19,7 +19,7 @@ internal LivenessPrometheusMetrics() _healthChecksResult = factory.CreateGauge("healthcheck", "Shows raw health check status (0 = Unhealthy, 1 = Degraded, 2 = Healthy)", new GaugeConfiguration { - LabelNames = new[] { HEALTH_CHECK_LABEL_NAME }, + LabelNames = [HEALTH_CHECK_LABEL_NAME], SuppressInitialValue = false }); @@ -27,7 +27,7 @@ internal LivenessPrometheusMetrics() "Shows duration of the health check execution in seconds", new GaugeConfiguration { - LabelNames = new[] { HEALTH_CHECK_LABEL_NAME }, + LabelNames = [HEALTH_CHECK_LABEL_NAME], SuppressInitialValue = false }); } diff --git a/src/HealthChecks.Publisher.Datadog/DatadogPublisher.cs b/src/HealthChecks.Publisher.Datadog/DatadogPublisher.cs index de9e5dedb8..1f02b92eb2 100644 --- a/src/HealthChecks.Publisher.Datadog/DatadogPublisher.cs +++ b/src/HealthChecks.Publisher.Datadog/DatadogPublisher.cs @@ -13,7 +13,7 @@ public DatadogPublisher(IDogStatsd dogStatsd, string serviceCheckName, string[]? { _dogStatsd = Guard.ThrowIfNull(dogStatsd); _serviceCheckName = Guard.ThrowIfNull(serviceCheckName); - _defaultTags = defaultTags ?? Array.Empty(); + _defaultTags = defaultTags ?? []; } public Task PublishAsync(HealthReport report, CancellationToken cancellationToken) @@ -43,10 +43,7 @@ public Task PublishAsync(HealthReport report, CancellationToken cancellationToke break; } - var tags = _defaultTags.Concat(new[] - { - $"check:{key}" - }).ToArray(); + var tags = _defaultTags.Concat([$"check:{key}"]).ToArray(); var message = entry.Description ?? entry.Status.ToString(); _dogStatsd.ServiceCheck(_serviceCheckName, dataDogStatus, null, Environment.MachineName, tags, message); diff --git a/src/HealthChecks.Publisher.Prometheus/LivenessPrometheusMetrics.cs b/src/HealthChecks.Publisher.Prometheus/LivenessPrometheusMetrics.cs index 956272d4c7..ec924b5544 100644 --- a/src/HealthChecks.Publisher.Prometheus/LivenessPrometheusMetrics.cs +++ b/src/HealthChecks.Publisher.Prometheus/LivenessPrometheusMetrics.cs @@ -19,7 +19,7 @@ internal LivenessPrometheusMetrics() _healthChecksResult = factory.CreateGauge("healthcheck", "Shows raw health check status (0 = Unhealthy, 1 = Degraded, 2 = Healthy)", new GaugeConfiguration { - LabelNames = new[] { HEALTH_CHECK_LABEL_NAME }, + LabelNames = [HEALTH_CHECK_LABEL_NAME], SuppressInitialValue = false }); @@ -27,7 +27,7 @@ internal LivenessPrometheusMetrics() "Shows duration of the health check execution in seconds", new GaugeConfiguration { - LabelNames = new[] { HEALTH_CHECK_LABEL_NAME }, + LabelNames = [HEALTH_CHECK_LABEL_NAME], SuppressInitialValue = false }); } diff --git a/src/HealthChecks.Publisher.Seq/SeqPublisher.cs b/src/HealthChecks.Publisher.Seq/SeqPublisher.cs index 086d024081..3c196b957d 100644 --- a/src/HealthChecks.Publisher.Seq/SeqPublisher.cs +++ b/src/HealthChecks.Publisher.Seq/SeqPublisher.cs @@ -38,8 +38,8 @@ public async Task PublishAsync(HealthReport report, CancellationToken cancellati var events = new RawEvents { - Events = new RawEvent[] - { + Events = + [ new RawEvent { Timestamp = DateTimeOffset.UtcNow, @@ -54,7 +54,7 @@ public async Task PublishAsync(HealthReport report, CancellationToken cancellati { "RawReport" , JsonSerializer.Serialize(report)} } } - } + ] }; _options.Configure?.Invoke(events); diff --git a/src/HealthChecks.UI.Client/UIResponseWriter.cs b/src/HealthChecks.UI.Client/UIResponseWriter.cs index 803163bc64..0ac71f93ce 100644 --- a/src/HealthChecks.UI.Client/UIResponseWriter.cs +++ b/src/HealthChecks.UI.Client/UIResponseWriter.cs @@ -12,7 +12,7 @@ public static class UIResponseWriter { private const string DEFAULT_CONTENT_TYPE = "application/json"; - private static readonly byte[] _emptyResponse = new byte[] { (byte)'{', (byte)'}' }; + private static readonly byte[] _emptyResponse = [(byte)'{', (byte)'}']; private static readonly Lazy _options = new(CreateJsonOptions); #pragma warning disable IDE1006 // Naming Styles diff --git a/test/HealthChecks.ArangoDb.Tests/Functional/ArangoDbHealthCheckTests.cs b/test/HealthChecks.ArangoDb.Tests/Functional/ArangoDbHealthCheckTests.cs index 728dbdde72..b7c178428a 100644 --- a/test/HealthChecks.ArangoDb.Tests/Functional/ArangoDbHealthCheckTests.cs +++ b/test/HealthChecks.ArangoDb.Tests/Functional/ArangoDbHealthCheckTests.cs @@ -17,7 +17,7 @@ public async Task be_healthy_if_arangodb_is_available() Database = "_system", UserName = "root", Password = "strongArangoDbPassword" - }, tags: new string[] { "arangodb" }); + }, tags: ["arangodb"]); }) .Configure(app => { @@ -47,7 +47,7 @@ public async Task be_healthy_if_multiple_arango_are_available() Database = "_system", UserName = "root", Password = "strongArangoDbPassword" - }, tags: new string[] { "arango" }, name: "1") + }, tags: ["arango"], name: "1") .AddArangoDb(_ => new ArangoDbOptions { HostUri = "http://localhost:8529/", @@ -55,7 +55,7 @@ public async Task be_healthy_if_multiple_arango_are_available() UserName = "root", Password = "strongArangoDbPassword", IsGenerateJwtTokenBasedOnUserNameAndPassword = true - }, tags: new string[] { "arango" }, name: "2"); + }, tags: ["arango"], name: "2"); }) .Configure(app => { @@ -85,7 +85,7 @@ public async Task be_unhealthy_if_arango_is_not_available() Database = "_system", UserName = "root", Password = "invalid password" - }, tags: new string[] { "arango" }); + }, tags: ["arango"]); }) .Configure(app => { diff --git a/test/HealthChecks.Aws.Sns.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.Aws.Sns.Tests/DependencyInjection/RegistrationTests.cs index 1b41ec6692..b6e9a9038c 100644 --- a/test/HealthChecks.Aws.Sns.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.Aws.Sns.Tests/DependencyInjection/RegistrationTests.cs @@ -34,7 +34,7 @@ public void add_health_check_with_topics_and_subscriptions_when_properly_configu .AddSnsTopicsAndSubscriptions(setup => { setup.Credentials = new BasicAWSCredentials("access-key", "secret-key"); - setup.AddTopicAndSubscriptions("topic1", new string[] { "subscription1-arn", "subscription2-arn" }); + setup.AddTopicAndSubscriptions("topic1", ["subscription1-arn", "subscription2-arn"]); }); using var serviceProvider = services.BuildServiceProvider(); @@ -76,7 +76,7 @@ public void add_health_check_with_topics_and_subscriptions_assumerole_when_prope .AddSnsTopicsAndSubscriptions(setup => { setup.Credentials = new AssumeRoleAWSCredentials(null, "role-arn", "session-name"); - setup.AddTopicAndSubscriptions("topic1", new string[] { "subscription1-arn", "subscription2-arn" }); + setup.AddTopicAndSubscriptions("topic1", ["subscription1-arn", "subscription2-arn"]); }); using var serviceProvider = services.BuildServiceProvider(); diff --git a/test/HealthChecks.Azure.Data.Tables.Tests/TableServiceHealthCheckTests.cs b/test/HealthChecks.Azure.Data.Tables.Tests/TableServiceHealthCheckTests.cs index 6606790eb3..a0ed777c96 100644 --- a/test/HealthChecks.Azure.Data.Tables.Tests/TableServiceHealthCheckTests.cs +++ b/test/HealthChecks.Azure.Data.Tables.Tests/TableServiceHealthCheckTests.cs @@ -39,7 +39,7 @@ public async Task return_healthy_when_only_checking_healthy_service() _tableServiceClient .QueryAsync(filter: "false", cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); var actual = await _healthCheck.CheckHealthAsync(_context, tokenSource.Token); @@ -61,11 +61,11 @@ public async Task return_healthy_when_checking_healthy_service_and_table() _tableServiceClient .QueryAsync(filter: "false", cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); _tableClient .QueryAsync(filter: "false", cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); _options.TableName = TableName; var actual = await _healthCheck.CheckHealthAsync(_context, tokenSource.Token); @@ -138,7 +138,7 @@ public async Task return_unhealthy_when_checking_unhealthy_container() _tableServiceClient .QueryAsync(filter: "false", cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); _tableClient .QueryAsync(filter: "false", cancellationToken: tokenSource.Token) @@ -193,7 +193,7 @@ public async Task return_unhealthy_when_invoked_from_healthcheckservice() _tableServiceClient .QueryAsync(filter: "false", cancellationToken: Arg.Any()) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); _tableClient .QueryAsync(filter: "false", cancellationToken: Arg.Any()) diff --git a/test/HealthChecks.Azure.Storage.Blobs.Tests/AzureBlobStorageHealthCheckTests.cs b/test/HealthChecks.Azure.Storage.Blobs.Tests/AzureBlobStorageHealthCheckTests.cs index d18ad18061..b11b75d6c4 100644 --- a/test/HealthChecks.Azure.Storage.Blobs.Tests/AzureBlobStorageHealthCheckTests.cs +++ b/test/HealthChecks.Azure.Storage.Blobs.Tests/AzureBlobStorageHealthCheckTests.cs @@ -39,7 +39,7 @@ public async Task return_healthy_when_only_checking_healthy_service() _blobServiceClient .GetBlobContainersAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); var actual = await _healthCheck.CheckHealthAsync(_context, tokenSource.Token); @@ -61,7 +61,7 @@ public async Task return_healthy_when_checking_healthy_service_and_container() _blobServiceClient .GetBlobContainersAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _blobContainerClient .GetPropertiesAsync(conditions: null, cancellationToken: tokenSource.Token) @@ -144,7 +144,7 @@ public async Task return_unhealthy_when_checking_unhealthy_container() _blobServiceClient .GetBlobContainersAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _blobContainerClient .GetPropertiesAsync(conditions: null, cancellationToken: tokenSource.Token) @@ -180,7 +180,7 @@ public async Task return_unhealthy_when_invoked_from_healthcheckservice() _blobServiceClient .GetBlobContainersAsync(cancellationToken: Arg.Any()) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _blobContainerClient .GetPropertiesAsync(conditions: null, cancellationToken: Arg.Any()) diff --git a/test/HealthChecks.Azure.Storage.Files.Shares.Tests/AzureFileShareHealthCheckTests.cs b/test/HealthChecks.Azure.Storage.Files.Shares.Tests/AzureFileShareHealthCheckTests.cs index 273cef085f..f7522cb6a5 100644 --- a/test/HealthChecks.Azure.Storage.Files.Shares.Tests/AzureFileShareHealthCheckTests.cs +++ b/test/HealthChecks.Azure.Storage.Files.Shares.Tests/AzureFileShareHealthCheckTests.cs @@ -39,7 +39,7 @@ public async Task return_healthy_when_only_checking_healthy_service() _shareServiceClient .GetSharesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); var actual = await _healthCheck.CheckHealthAsync(_context, tokenSource.Token); @@ -61,7 +61,7 @@ public async Task return_healthy_when_checking_healthy_service_and_share() _shareServiceClient .GetSharesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _shareClient .GetPropertiesAsync(tokenSource.Token) @@ -143,7 +143,7 @@ public async Task return_unhealthy_when_checking_unhealthy_share() _shareServiceClient .GetSharesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _shareClient .GetPropertiesAsync(tokenSource.Token) @@ -178,7 +178,7 @@ public async Task return_unhealthy_when_invoked_from_healthcheckservice() _shareServiceClient .GetSharesAsync(cancellationToken: Arg.Any()) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _shareClient .GetPropertiesAsync(Arg.Any()) diff --git a/test/HealthChecks.Azure.Storage.Queues.Tests/AzureQueueStorageHealthCheckTests.cs b/test/HealthChecks.Azure.Storage.Queues.Tests/AzureQueueStorageHealthCheckTests.cs index f5583b8943..d463de341d 100644 --- a/test/HealthChecks.Azure.Storage.Queues.Tests/AzureQueueStorageHealthCheckTests.cs +++ b/test/HealthChecks.Azure.Storage.Queues.Tests/AzureQueueStorageHealthCheckTests.cs @@ -39,7 +39,7 @@ public async Task return_healthy_when_only_checking_healthy_service() _queueServiceClient .GetQueuesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(Array.Empty>())); + .Returns(AsyncPageable.FromPages([])); var actual = await _healthCheck.CheckHealthAsync(_context, tokenSource.Token); @@ -61,7 +61,7 @@ public async Task return_healthy_when_checking_healthy_service_and_queue() _queueServiceClient .GetQueuesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _queueClient .GetPropertiesAsync(tokenSource.Token) @@ -143,7 +143,7 @@ public async Task return_unhealthy_when_checking_unhealthy_queue() _queueServiceClient .GetQueuesAsync(cancellationToken: tokenSource.Token) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _queueClient .GetPropertiesAsync(tokenSource.Token) @@ -178,7 +178,7 @@ public async Task return_unhealthy_when_invoked_from_healthcheckservice() _queueServiceClient .GetQueuesAsync(cancellationToken: Arg.Any()) - .Returns(AsyncPageable.FromPages(new[] { Substitute.For>() })); + .Returns(AsyncPageable.FromPages([Substitute.For>()])); _queueClient .GetPropertiesAsync(Arg.Any()) diff --git a/test/HealthChecks.AzureDigitalTwin.Tests/DependencyInjection/AzureDigitalTwinModelUnitTests.cs b/test/HealthChecks.AzureDigitalTwin.Tests/DependencyInjection/AzureDigitalTwinModelUnitTests.cs index a6accd9ca6..76f9abb0a2 100644 --- a/test/HealthChecks.AzureDigitalTwin.Tests/DependencyInjection/AzureDigitalTwinModelUnitTests.cs +++ b/test/HealthChecks.AzureDigitalTwin.Tests/DependencyInjection/AzureDigitalTwinModelUnitTests.cs @@ -14,7 +14,7 @@ public void add_health_check_when_properly_configured() "MyDigitalTwinClientSecret", "TenantId", "https://my-awesome-dt-host", - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }); + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"]); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -36,7 +36,7 @@ public void add_named_health_check_when_properly_configured() "MyDigitalTwinClientSecret", "TenantId", "https://my-awesome-dt-host", - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }, + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"], name: "azuredigitaltwinmodels_check"); using var serviceProvider = services.BuildServiceProvider(); @@ -54,7 +54,7 @@ public void fail_when_no_health_check_configuration_provided() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddAzureDigitalTwinModels(string.Empty, string.Empty, string.Empty, string.Empty, new string[] { }); + .AddAzureDigitalTwinModels(string.Empty, string.Empty, string.Empty, string.Empty, []); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -72,7 +72,7 @@ public void add_health_check_when_properly_configured_by_credentials() .AddAzureDigitalTwinModels( new MockTokenCredentials(), "https://my-awesome-dt-host", - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }); + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"]); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -92,7 +92,7 @@ public void add_named_health_check_when_properly_configured_by_credentials() .AddAzureDigitalTwinModels( new MockTokenCredentials(), "https://my-awesome-dt-host", - new string[] { "my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1" }, + ["my:dt:definition_a;1", "my:dt:definition_b;1", "my:dt:definition_c;1"], name: "azuredigitaltwinmodels_check"); using var serviceProvider = services.BuildServiceProvider(); @@ -110,7 +110,7 @@ public void fail_when_no_health_check_configuration_provided_by_credentials() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddAzureDigitalTwinModels(new AzureCliCredential(), string.Empty, new string[] { }); + .AddAzureDigitalTwinModels(new AzureCliCredential(), string.Empty, []); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); diff --git a/test/HealthChecks.Consul.Tests/Functional/ConsulHealthCheckTests.cs b/test/HealthChecks.Consul.Tests/Functional/ConsulHealthCheckTests.cs index 7aa2e8550a..cf0f557c94 100644 --- a/test/HealthChecks.Consul.Tests/Functional/ConsulHealthCheckTests.cs +++ b/test/HealthChecks.Consul.Tests/Functional/ConsulHealthCheckTests.cs @@ -16,7 +16,7 @@ public async Task be_healthy_if_consul_is_available() setup.HostName = "localhost"; setup.Port = 8500; setup.RequireHttps = false; - }, tags: new string[] { "consul" }); + }, tags: ["consul"]); }) .Configure(app => { @@ -45,7 +45,7 @@ public async Task be_unhealthy_if_consul_is_not_available() setup.HostName = "non-existing-host"; setup.Port = 8500; setup.RequireHttps = false; - }, tags: new string[] { "consul" }); + }, tags: ["consul"]); }) .Configure(app => { diff --git a/test/HealthChecks.CosmosDb.Tests/CosmosDbHealthCheckTests.cs b/test/HealthChecks.CosmosDb.Tests/CosmosDbHealthCheckTests.cs index 7ce7f00ec1..8656c7be0d 100644 --- a/test/HealthChecks.CosmosDb.Tests/CosmosDbHealthCheckTests.cs +++ b/test/HealthChecks.CosmosDb.Tests/CosmosDbHealthCheckTests.cs @@ -8,7 +8,7 @@ namespace HealthChecks.CosmosDb.Tests; public class cosmosdbhealthcheck_should { - private static readonly string[] ContainerIds = { "one", "two", "three" }; + private static readonly string[] ContainerIds = ["one", "two", "three"]; private const string DatabaseId = "unit-test"; private const string HealthCheckName = "unit-test-check"; diff --git a/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchAuthenticationTests.cs b/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchAuthenticationTests.cs index 2bcf44def3..598ea92c29 100644 --- a/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchAuthenticationTests.cs +++ b/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchAuthenticationTests.cs @@ -31,7 +31,7 @@ public async Task be_healthy_if_elasticsearch_is_using_valid_api_key() return true; }); options.RequestTimeout = TimeSpan.FromSeconds(30); - }, tags: new[] { "elasticsearch" }); + }, tags: ["elasticsearch"]); }) .Configure(app => { @@ -66,7 +66,7 @@ public async Task be_healthy_if_elasticsearch_is_using_valid_user_and_password() return true; }); options.RequestTimeout = TimeSpan.FromSeconds(30); - }, tags: new[] { "elasticsearch" }); + }, tags: ["elasticsearch"]); }) .Configure(app => { diff --git a/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchHealthCheckTests.cs b/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchHealthCheckTests.cs index d477d3acd4..1101ee18f9 100644 --- a/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchHealthCheckTests.cs +++ b/test/HealthChecks.Elasticsearch.Tests/Functional/ElasticsearchHealthCheckTests.cs @@ -13,7 +13,7 @@ public async Task be_healthy_if_elasticsearch_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddElasticsearch(connectionString, tags: new string[] { "elasticsearch" }); + .AddElasticsearch(connectionString, tags: ["elasticsearch"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_unhealthy_if_elasticsearch_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddElasticsearch("nonexistingdomain:9200", tags: new string[] { "elasticsearch" }); + .AddElasticsearch("nonexistingdomain:9200", tags: ["elasticsearch"]); }) .Configure(app => { diff --git a/test/HealthChecks.EventStore.Tests/Functional/EventStoreHealthCheckTests.cs b/test/HealthChecks.EventStore.Tests/Functional/EventStoreHealthCheckTests.cs index 1c679f1782..c26656ad6e 100644 --- a/test/HealthChecks.EventStore.Tests/Functional/EventStoreHealthCheckTests.cs +++ b/test/HealthChecks.EventStore.Tests/Functional/EventStoreHealthCheckTests.cs @@ -12,7 +12,7 @@ public async Task be_healthy_if_eventstore_is_available_with_uri_format() .ConfigureServices(services => { services.AddHealthChecks() - .AddEventStore("ConnectTo=tcp://localhost:1113; UseSslConnection=false", tags: new string[] { "eventstore" }); + .AddEventStore("ConnectTo=tcp://localhost:1113; UseSslConnection=false", tags: ["eventstore"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_healthy_if_eventstore_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddEventStore("ConnectTo=tcp://localhost:1113; UseSslConnection=false; HeartBeatTimeout=500", tags: new string[] { "eventstore" }); + .AddEventStore("ConnectTo=tcp://localhost:1113; UseSslConnection=false; HeartBeatTimeout=500", tags: ["eventstore"]); }) .Configure(app => { @@ -63,7 +63,7 @@ public async Task be_unhealthy_if_eventstore_is_not_available() { // Existing hostname, incorrect port. If the hostname cannot be reached, CreateRequest will hang. services.AddHealthChecks() - .AddEventStore("ConnectTo=tcp://localhost:1114; UseSslConnection=false; HeartBeatTimeout=500", tags: new string[] { "eventstore" }); + .AddEventStore("ConnectTo=tcp://localhost:1114; UseSslConnection=false; HeartBeatTimeout=500", tags: ["eventstore"]); }) .Configure(app => { diff --git a/test/HealthChecks.EventStore.gRPC.Tests/Functional/EventStoreHealthCheckTests.cs b/test/HealthChecks.EventStore.gRPC.Tests/Functional/EventStoreHealthCheckTests.cs index c4a740051e..09479b1ac6 100644 --- a/test/HealthChecks.EventStore.gRPC.Tests/Functional/EventStoreHealthCheckTests.cs +++ b/test/HealthChecks.EventStore.gRPC.Tests/Functional/EventStoreHealthCheckTests.cs @@ -11,7 +11,7 @@ public async Task be_healthy_if_eventstore_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddEventStore("esdb://localhost:2113?tls=false", tags: new[] { "eventstore" }); + .AddEventStore("esdb://localhost:2113?tls=false", tags: ["eventstore"]); }) .Configure(app => { @@ -35,7 +35,7 @@ public async Task be_unhealthy_if_eventstore_tls_settings_do_not_match() .ConfigureServices(services => { services.AddHealthChecks() - .AddEventStore("esdb://localhost:2113", tags: new[] { "eventstore" }); + .AddEventStore("esdb://localhost:2113", tags: ["eventstore"]); }) .Configure(app => { @@ -59,7 +59,7 @@ public async Task be_unhealthy_if_eventstore_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddEventStore("esdb://nonexistingdomain:2113?tls=false", tags: new[] { "eventstore" }); + .AddEventStore("esdb://nonexistingdomain:2113?tls=false", tags: ["eventstore"]); }) .Configure(app => { diff --git a/test/HealthChecks.Gcp.CloudFirestore.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.Gcp.CloudFirestore.Tests/DependencyInjection/RegistrationTests.cs index 652ef85d74..8c0b885cfe 100644 --- a/test/HealthChecks.Gcp.CloudFirestore.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.Gcp.CloudFirestore.Tests/DependencyInjection/RegistrationTests.cs @@ -7,7 +7,7 @@ public void add_health_check_when_properly_configured() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddCloudFirestore(setup => setup.RequiredCollections = new string[] { }); + .AddCloudFirestore(setup => setup.RequiredCollections = []); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -23,7 +23,7 @@ public void add_named_health_check_when_properly_configured() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddCloudFirestore(setup => setup.RequiredCollections = new string[] { }, name: "my-cloud-firestore-group"); + .AddCloudFirestore(setup => setup.RequiredCollections = [], name: "my-cloud-firestore-group"); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); diff --git a/test/HealthChecks.Gremlin.Tests/Functional/GremlinHealthCheckTests.cs b/test/HealthChecks.Gremlin.Tests/Functional/GremlinHealthCheckTests.cs index 22a2340e36..606b9de636 100644 --- a/test/HealthChecks.Gremlin.Tests/Functional/GremlinHealthCheckTests.cs +++ b/test/HealthChecks.Gremlin.Tests/Functional/GremlinHealthCheckTests.cs @@ -16,7 +16,7 @@ public async Task be_healthy_if_gremlin_is_available() Hostname = "localhost", Port = 8182, EnableSsl = false - }, tags: new string[] { "gremlin" }); + }, tags: ["gremlin"]); }) .Configure(app => { @@ -45,13 +45,13 @@ public async Task be_healthy_if_multiple_gremlin_are_available() Hostname = "localhost", Port = 8182, EnableSsl = false - }, tags: new string[] { "gremlin" }, name: "1") + }, tags: ["gremlin"], name: "1") .AddGremlin(_ => new GremlinOptions { Hostname = "localhost", Port = 8182, EnableSsl = false - }, tags: new string[] { "gremlin" }, name: "2"); + }, tags: ["gremlin"], name: "2"); }) .Configure(app => { @@ -80,7 +80,7 @@ public async Task be_unhealthy_if_gremlin_is_not_available() Hostname = "wronghost", Port = 8182, EnableSsl = false - }, tags: new string[] { "gremlin" }); + }, tags: ["gremlin"]); }) .Configure(app => { diff --git a/test/HealthChecks.IbmMQ.Tests/Functional/IbmMQHealthCheckTests.cs b/test/HealthChecks.IbmMQ.Tests/Functional/IbmMQHealthCheckTests.cs index 9043a12956..fb0872c2f1 100644 --- a/test/HealthChecks.IbmMQ.Tests/Functional/IbmMQHealthCheckTests.cs +++ b/test/HealthChecks.IbmMQ.Tests/Functional/IbmMQHealthCheckTests.cs @@ -40,7 +40,7 @@ public async Task be_healthy_if_ibmmq_is_available() { services .AddHealthChecks() - .AddIbmMQ(qManager, properties, tags: new string[] { "ibmmq" }); + .AddIbmMQ(qManager, properties, tags: ["ibmmq"]); }) .Configure(app => { @@ -74,7 +74,7 @@ public async Task be_unhealthy_if_ibmmq_is_unavailable() { services .AddHealthChecks() - .AddIbmMQ(qManager, properties, tags: new string[] { "ibmmq" }); + .AddIbmMQ(qManager, properties, tags: ["ibmmq"]); }) .Configure(app => { @@ -99,7 +99,7 @@ public async Task be_unhealthy_if_ibmmq_managed_is_unavailable() { services .AddHealthChecks() - .AddIbmMQManagedConnection(qManager, channel, wrongHostName, user, password, tags: new string[] { "ibmmq" }); + .AddIbmMQManagedConnection(qManager, channel, wrongHostName, user, password, tags: ["ibmmq"]); }) .Configure(app => { @@ -124,7 +124,7 @@ public async Task be_healthy_if_ibmmq_managed_is_available() { services .AddHealthChecks() - .AddIbmMQManagedConnection(qManager, channel, hostName, user, password, tags: new string[] { "ibmmq" }); + .AddIbmMQManagedConnection(qManager, channel, hostName, user, password, tags: ["ibmmq"]); }) .Configure(app => { diff --git a/test/HealthChecks.InfluxDB.Tests/Functional/InfluxDBHealthCheckTests.cs b/test/HealthChecks.InfluxDB.Tests/Functional/InfluxDBHealthCheckTests.cs index 05b55ad5fc..1df8dad343 100644 --- a/test/HealthChecks.InfluxDB.Tests/Functional/InfluxDBHealthCheckTests.cs +++ b/test/HealthChecks.InfluxDB.Tests/Functional/InfluxDBHealthCheckTests.cs @@ -12,7 +12,7 @@ public async Task be_healthy_if_influxdb_is_available() { services .AddHealthChecks() - .AddInfluxDB("http://localhost:8086/?org=influxdata&bucket=dummy&latest=-72h", "ci_user", "password", "influxdb", tags: new string[] { "influxdb" }); + .AddInfluxDB("http://localhost:8086/?org=influxdata&bucket=dummy&latest=-72h", "ci_user", "password", "influxdb", tags: ["influxdb"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_unhealthy_if_influxdb_is_unavailable() { services .AddHealthChecks() - .AddInfluxDB("http://localhost:8086/?org=influxdata&bucket=dummy&latest=-72h", "ci_user_unavailable", "password", "influxdb", tags: new string[] { "influxdb" }); + .AddInfluxDB("http://localhost:8086/?org=influxdata&bucket=dummy&latest=-72h", "ci_user_unavailable", "password", "influxdb", tags: ["influxdb"]); }) .Configure(app => { diff --git a/test/HealthChecks.Kafka.Tests/Functional/KafkaHealthCheckTests.cs b/test/HealthChecks.Kafka.Tests/Functional/KafkaHealthCheckTests.cs index 606b5f0ed2..d3341692b3 100644 --- a/test/HealthChecks.Kafka.Tests/Functional/KafkaHealthCheckTests.cs +++ b/test/HealthChecks.Kafka.Tests/Functional/KafkaHealthCheckTests.cs @@ -21,7 +21,7 @@ public async Task be_unhealthy_if_kafka_is_unavailable() .ConfigureServices(services => { services.AddHealthChecks() - .AddKafka(configuration, tags: new string[] { "kafka" }); + .AddKafka(configuration, tags: ["kafka"]); }) .Configure(app => { @@ -51,7 +51,7 @@ public async Task be_healthy_if_kafka_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddKafka(configuration, tags: new string[] { "kafka" }); + .AddKafka(configuration, tags: ["kafka"]); }) .Configure(app => { diff --git a/test/HealthChecks.Kubernetes.Tests/Functional/KubernetesHealthCheckTests.cs b/test/HealthChecks.Kubernetes.Tests/Functional/KubernetesHealthCheckTests.cs index f636705494..e3f3303266 100644 --- a/test/HealthChecks.Kubernetes.Tests/Functional/KubernetesHealthCheckTests.cs +++ b/test/HealthChecks.Kubernetes.Tests/Functional/KubernetesHealthCheckTests.cs @@ -17,7 +17,7 @@ public async Task be_unhealthy_if_kubernetes_is_unavailable() { Host = "https://localhost:443", SkipTlsVerify = true - }).CheckService("DummyService", s => s.Spec.Type == "LoadBalancer"), tags: new string[] { "k8s" }); + }).CheckService("DummyService", s => s.Spec.Type == "LoadBalancer"), tags: ["k8s"]); }) .Configure(app => { @@ -46,7 +46,7 @@ public async Task be_healthy_if_empty_registrations() { Host = "https://localhost:443", SkipTlsVerify = true - }), tags: new string[] { "k8s" }); + }), tags: ["k8s"]); }) .Configure(app => { @@ -75,7 +75,7 @@ public async Task be_healthy_if_kubernetes_is_available() { Host = "https://localhost:443", SkipTlsVerify = true - }).CheckService("DummyService", s => s.Spec.Type == "LoadBalancer"), tags: new string[] { "k8s" }); + }).CheckService("DummyService", s => s.Spec.Type == "LoadBalancer"), tags: ["k8s"]); }) .Configure(app => { diff --git a/test/HealthChecks.MongoDb.Tests/Functional/MongoDbHealthCheckTests.cs b/test/HealthChecks.MongoDb.Tests/Functional/MongoDbHealthCheckTests.cs index 55482b6161..a8c62dab7c 100644 --- a/test/HealthChecks.MongoDb.Tests/Functional/MongoDbHealthCheckTests.cs +++ b/test/HealthChecks.MongoDb.Tests/Functional/MongoDbHealthCheckTests.cs @@ -13,7 +13,7 @@ public async Task be_healthy_listing_all_databases_if_mongodb_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb(connectionString, tags: new string[] { "mongodb" }); + .AddMongoDb(connectionString, tags: ["mongodb"]); }) .Configure(app => { @@ -39,7 +39,7 @@ public async Task be_healthy_on_specified_database_if_mongodb_is_available_and_d .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb(connectionString, mongoDatabaseName: "local", tags: new string[] { "mongodb" }); + .AddMongoDb(connectionString, mongoDatabaseName: "local", tags: ["mongodb"]); }) .Configure(app => { @@ -64,7 +64,7 @@ public async Task be_healthy_on_connectionstring_specified_database_if_mongodb_i .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb(connectionString, tags: new string[] { "mongodb" }); + .AddMongoDb(connectionString, tags: ["mongodb"]); }) .Configure(app => { @@ -90,7 +90,7 @@ public async Task be_healthy_on_connectionstring_specified_database_if_mongodb_i .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb(connectionString, tags: new string[] { "mongodb" }); + .AddMongoDb(connectionString, tags: ["mongodb"]); }) .Configure(app => { @@ -114,7 +114,7 @@ public async Task be_unhealthy_listing_all_databases_if_mongodb_is_not_available .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb("mongodb://nonexistingdomain:27017", tags: new string[] { "mongodb" }); + .AddMongoDb("mongodb://nonexistingdomain:27017", tags: ["mongodb"]); }) .Configure(app => { @@ -138,7 +138,7 @@ public async Task be_unhealthy_on_specified_database_if_mongodb_is_not_available .ConfigureServices(services => { services.AddHealthChecks() - .AddMongoDb("mongodb://nonexistingdomain:27017", tags: new string[] { "mongodb" }); + .AddMongoDb("mongodb://nonexistingdomain:27017", tags: ["mongodb"]); }) .Configure(app => { diff --git a/test/HealthChecks.MySql.Tests/Functional/MySqlHealthCheckTests.cs b/test/HealthChecks.MySql.Tests/Functional/MySqlHealthCheckTests.cs index 802b54f85c..c5b42aeaea 100644 --- a/test/HealthChecks.MySql.Tests/Functional/MySqlHealthCheckTests.cs +++ b/test/HealthChecks.MySql.Tests/Functional/MySqlHealthCheckTests.cs @@ -13,7 +13,7 @@ public async Task be_healthy_when_mysql_server_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddMySql(connectionString, tags: new string[] { "mysql" }); + .AddMySql(connectionString, tags: ["mysql"]); }) .Configure(app => { @@ -39,7 +39,7 @@ public async Task be_unhealthy_when_mysql_server_is_unavailable() .ConfigureServices(services => { services.AddHealthChecks() - .AddMySql(connectionString, tags: new string[] { "mysql" }); + .AddMySql(connectionString, tags: ["mysql"]); }) .Configure(app => { @@ -69,7 +69,7 @@ public async Task be_unhealthy_when_mysql_server_is_unavailable_using_options() ConnectionString = connectionString }; services.AddHealthChecks() - .AddMySql(mysqlOptions, tags: new string[] { "mysql" }); + .AddMySql(mysqlOptions, tags: ["mysql"]); }) .Configure(app => { diff --git a/test/HealthChecks.Nats.Tests/Defines.cs b/test/HealthChecks.Nats.Tests/Defines.cs index b1728d7ca5..793700bf79 100644 --- a/test/HealthChecks.Nats.Tests/Defines.cs +++ b/test/HealthChecks.Nats.Tests/Defines.cs @@ -11,7 +11,7 @@ internal class Defines public const string NatsName = "nats"; public const string CustomRegistrationName = nameof(CustomRegistrationName); - public static readonly string[] Tags = new string[] { NatsName }; + public static readonly string[] Tags = [NatsName]; public const string HealthRequestRelativePath = "/health"; } diff --git a/test/HealthChecks.Network.Tests/Functional/DnsHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/DnsHealthCheckTests.cs index e91210d57b..f7aa079808 100644 --- a/test/HealthChecks.Network.Tests/Functional/DnsHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/DnsHealthCheckTests.cs @@ -21,7 +21,7 @@ public async Task be_healthy_when_configured_hosts_dns_resolution_matches() { setup.ResolveHost(targetHost).To(targetHostIpAddresses) .ResolveHost(targetHost2).To(targetHost2IpAddresses); - }, tags: new string[] { "dns" }); + }, tags: ["dns"]); }) .Configure(app => { @@ -44,7 +44,7 @@ public async Task be_unhealthy_when_dns_resolution_does_not_match_configured_hos .ConfigureServices(services => { services.AddHealthChecks() - .AddDnsResolveHealthCheck(setup => setup.ResolveHost("www.microsoft.com").To("8.8.8.8", "5.5.5.5"), tags: new string[] { "dns" }); + .AddDnsResolveHealthCheck(setup => setup.ResolveHost("www.microsoft.com").To("8.8.8.8", "5.5.5.5"), tags: ["dns"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/FtpHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/FtpHealthCheckTests.cs index 777cc93cd0..813d5eca28 100644 --- a/test/HealthChecks.Network.Tests/Functional/FtpHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/FtpHealthCheckTests.cs @@ -18,7 +18,7 @@ public async Task be_healthy_when_connection_is_successful() setup.AddHost("ftp://localhost:21", createFile: false, credentials: new NetworkCredential("bob", "12345")); - }, tags: new string[] { "ftp" }); + }, tags: ["ftp"]); }) .Configure(app => { @@ -46,7 +46,7 @@ public async Task be_healthy_when_connection_is_successful_and_file_is_created() setup.AddHost("ftp://localhost:21", createFile: true, credentials: new NetworkCredential("bob", "12345")); - }, tags: new string[] { "ftp" }); + }, tags: ["ftp"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/ImapHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/ImapHealthCheckTests.cs index 9a58640a26..4df4e8d558 100644 --- a/test/HealthChecks.Network.Tests/Functional/ImapHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/ImapHealthCheckTests.cs @@ -23,7 +23,7 @@ public async Task be_healthy_when_connecting_to_imap_ssl_port_without_login() setup.Host = _host; setup.Port = 993; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -52,7 +52,7 @@ public async Task be_healthy_when_connecting_to_imap_ssl_and_login_with_correct_ setup.Port = 993; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -82,7 +82,7 @@ public async Task be_unhealthy_when_connecting_to_imap_ssl_and_login_with_an_inc setup.ConnectionType = ImapConnectionType.SSL_TLS; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith("invalid@healthchecks.com", "invalidpassword"); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -112,7 +112,7 @@ public async Task be_healthy_when_connecting_to_imap_ssl_with_a_correct_account_ setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); setup.CheckFolderExists("INBOX"); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -142,7 +142,7 @@ public async Task be_unhealthy_when_connecting_to_imap_ssl_with_a_correct_accoun setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); setup.CheckFolderExists("INVALIDFOLDER"); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -170,7 +170,7 @@ public async Task be_healthy_when_imap_connects_to_starttls_port() setup.Host = _host; setup.Port = 143; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -199,7 +199,7 @@ public async Task be_healthy_when_imap_performs_login_using_starttls_handshake() setup.Port = 143; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -230,7 +230,7 @@ public async Task be_healthy_when_imap_performs_login_and_folder_check_using_sta setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); setup.CheckFolderExists("INBOX"); - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { @@ -257,7 +257,7 @@ public async Task be_unhealthy_when_using_configuration_auto_with_an_invalid_ima { setup.Host = _host; setup.Port = 135; - }, tags: new string[] { "imap" }); + }, tags: ["imap"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/PingHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/PingHealthCheckTests.cs index dca913afb6..cba2316566 100644 --- a/test/HealthChecks.Network.Tests/Functional/PingHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/PingHealthCheckTests.cs @@ -11,7 +11,7 @@ public async Task be_healthy_when_all_hosts_reply_to_ping() .ConfigureServices(services => { services.AddHealthChecks() - .AddPingHealthCheck(setup => setup.AddHost("127.0.0.1", 5000), tags: new string[] { "ping" }); + .AddPingHealthCheck(setup => setup.AddHost("127.0.0.1", 5000), tags: ["ping"]); }) .Configure(app => { @@ -38,7 +38,7 @@ public async Task be_unhealthy_when_a_host_ping_is_not_successful() { setup.AddHost("127.0.0.1", 3000); setup.AddHost("nonexistinghost", 3000); - }, tags: new string[] { "ping" }); + }, tags: ["ping"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/SftpHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/SftpHealthCheckTests.cs index a869605943..1332cb3aae 100644 --- a/test/HealthChecks.Network.Tests/Functional/SftpHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/SftpHealthCheckTests.cs @@ -19,7 +19,7 @@ public async Task be_healthy_when_connection_to_sftp_is_successful_using_passwor .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }, timeout: TimeSpan.FromSeconds(5)); + }, tags: ["sftp"], timeout: TimeSpan.FromSeconds(5)); }) .Configure(app => { @@ -50,7 +50,7 @@ public async Task be_unhealthy_when_connection_to_sftp_is_using_wrong_password() .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }); + }, tags: ["sftp"]); }) .Configure(app => { @@ -83,7 +83,7 @@ public async Task be_healthy_when_connection_to_sftp_is_successful_using_private .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }); + }, tags: ["sftp"]); }) .Configure(app => { @@ -117,7 +117,7 @@ public async Task be_healthy_with_valid_authorization_and_file_creation_enabled( .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }); + }, tags: ["sftp"]); }) .Configure(app => { @@ -151,7 +151,7 @@ public async Task be_healthy_with_one_valid_authorization() .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }); + }, tags: ["sftp"]); }) .Configure(app => { @@ -182,7 +182,7 @@ public async Task be_unhealthy_when_using_wrong_port() .Build(); setup.AddHost(cfg); - }, tags: new string[] { "sftp" }); + }, tags: ["sftp"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/SmtpHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/SmtpHealthCheckTests.cs index a53127b10c..99d137a611 100644 --- a/test/HealthChecks.Network.Tests/Functional/SmtpHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/SmtpHealthCheckTests.cs @@ -26,7 +26,7 @@ public async Task be_healthy_when_connecting_using_ssl() setup.Port = 465; setup.ConnectionType = SmtpConnectionType.SSL; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -56,7 +56,7 @@ public async Task be_healthy_when_connecting_using_tls() setup.Port = 587; setup.ConnectionType = SmtpConnectionType.TLS; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -84,7 +84,7 @@ public async Task be_healthy_when_connecting_using_connection_type_auto() setup.Host = _host; setup.Port = 587; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -112,7 +112,7 @@ public async Task be_unhealthy_when_connecting_to_an_invalid_smtp_port_with_mode setup.Host = _host; setup.Port = 45; setup.AllowInvalidRemoteCertificates = true; - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -141,7 +141,7 @@ public async Task be_healthy_when_connection_and_login_with_valid_account_using_ setup.Port = 465; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -170,7 +170,7 @@ public async Task be_healthy_when_connection_and_login_with_valid_account_using_ setup.Port = 587; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, _validPassword); - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -200,7 +200,7 @@ public async Task be_unhealthy_when_connection_and_login_with_an_invalid_account setup.Port = 587; setup.AllowInvalidRemoteCertificates = true; setup.LoginWith(_validAccount, "wrongpass"); - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { @@ -234,7 +234,7 @@ This test is skipped as this service might not be working in the future */ setup.Port = 25; setup.ConnectionType = SmtpConnectionType.PLAIN; setup.LoginWith("user19@test.smtp.org", "pass19"); - }, tags: new string[] { "smtp" }); + }, tags: ["smtp"]); }) .Configure(app => { diff --git a/test/HealthChecks.Network.Tests/Functional/SslHealthCheckTests.cs b/test/HealthChecks.Network.Tests/Functional/SslHealthCheckTests.cs index 3c55bab0f6..c070a12f03 100644 --- a/test/HealthChecks.Network.Tests/Functional/SslHealthCheckTests.cs +++ b/test/HealthChecks.Network.Tests/Functional/SslHealthCheckTests.cs @@ -24,7 +24,7 @@ public async Task be_healthy_if_ssl_is_valid() options.AddHost(_validHost256); options.AddHost(_validHost384); options.AddHost(_validHost512); - }, tags: new string[] { "ssl" }); + }, tags: ["ssl"]); }) .Configure(app => { @@ -48,7 +48,7 @@ public async Task be_unhealthy_if_ssl_is_not_present() .ConfigureServices(services => { services.AddHealthChecks() - .AddSslHealthCheck(options => options.AddHost(_httpHost, 80), tags: new string[] { "ssl" }); + .AddSslHealthCheck(options => options.AddHost(_httpHost, 80), tags: ["ssl"]); }) .Configure(app => { @@ -72,7 +72,7 @@ public async Task be_unhealthy_if_ssl_is_not_valid() .ConfigureServices(services => { services.AddHealthChecks() - .AddSslHealthCheck(options => options.AddHost(_revokedHost), tags: new string[] { "ssl" }); + .AddSslHealthCheck(options => options.AddHost(_revokedHost), tags: ["ssl"]); }) .Configure(app => { @@ -96,7 +96,7 @@ public async Task be_unhealthy_if_ssl_is_expired() .ConfigureServices(services => { services.AddHealthChecks() - .AddSslHealthCheck(options => options.AddHost(_expiredHost), tags: new string[] { "ssl" }); + .AddSslHealthCheck(options => options.AddHost(_expiredHost), tags: ["ssl"]); }) .Configure(app => { @@ -120,7 +120,7 @@ public async Task be_degraded_if_ssl_daysbefore() .ConfigureServices(services => { services.AddHealthChecks() - .AddSslHealthCheck(options => options.AddHost(_validHost256, checkLeftDays: 1095), tags: new string[] { "ssl" }); + .AddSslHealthCheck(options => options.AddHost(_validHost256, checkLeftDays: 1095), tags: ["ssl"]); }) .Configure(app => { diff --git a/test/HealthChecks.Npgsql.Tests/Functional/NpgsqlHealthCheckTests.cs b/test/HealthChecks.Npgsql.Tests/Functional/NpgsqlHealthCheckTests.cs index d76f01f5c2..93f5f9238a 100644 --- a/test/HealthChecks.Npgsql.Tests/Functional/NpgsqlHealthCheckTests.cs +++ b/test/HealthChecks.Npgsql.Tests/Functional/NpgsqlHealthCheckTests.cs @@ -20,7 +20,7 @@ public async Task be_healthy_if_npgsql_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddNpgSql(connectionString, tags: new string[] { "npgsql" }); + .AddNpgSql(connectionString, tags: ["npgsql"]); }) .Configure(app => { @@ -46,7 +46,7 @@ public async Task be_unhealthy_if_sql_query_is_not_valid() .ConfigureServices(services => { services.AddHealthChecks() - .AddNpgSql(connectionString, "SELECT 1 FROM InvalidDB", tags: new string[] { "npgsql" }); + .AddNpgSql(connectionString, "SELECT 1 FROM InvalidDB", tags: ["npgsql"]); }) .Configure(app => { @@ -70,7 +70,7 @@ public async Task be_unhealthy_if_npgsql_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddNpgSql("Server=200.0.0.1;Port=8010;User ID=postgres;Password=Password12!;database=postgres", tags: new string[] { "npgsql" }); + .AddNpgSql("Server=200.0.0.1;Port=8010;User ID=postgres;Password=Password12!;database=postgres", tags: ["npgsql"]); }) .Configure(app => { @@ -99,7 +99,7 @@ public async Task be_healthy_if_npgsql_is_available_by_iServiceProvider_register }); services.AddHealthChecks() - .AddNpgSql(_ => _.GetRequiredService().ConnectionString, tags: new string[] { "npgsql" }); + .AddNpgSql(_ => _.GetRequiredService().ConnectionString, tags: ["npgsql"]); }) .Configure(app => { @@ -128,7 +128,7 @@ public async Task be_unhealthy_if_npgsql_is_not_available_registered() }); services.AddHealthChecks() - .AddNpgSql(_ => _.GetRequiredService().ConnectionString, tags: new string[] { "npgsql" }); + .AddNpgSql(_ => _.GetRequiredService().ConnectionString, tags: ["npgsql"]); }) .Configure(app => { @@ -159,7 +159,7 @@ public async Task unhealthy_check_log_detailed_messages() .Services.TryAddEnumerable(ServiceDescriptor.Singleton()) ) .AddHealthChecks() - .AddNpgSql(connectionString, "SELECT 1 FROM InvalidDB", tags: new string[] { "npgsql" }); + .AddNpgSql(connectionString, "SELECT 1 FROM InvalidDB", tags: ["npgsql"]); }) .Configure(app => { diff --git a/test/HealthChecks.OpenIdConnectServer.Tests/Functional/DiscoveryEndpointResponseTests.cs b/test/HealthChecks.OpenIdConnectServer.Tests/Functional/DiscoveryEndpointResponseTests.cs index 7752b8b395..f6d3ebd80e 100644 --- a/test/HealthChecks.OpenIdConnectServer.Tests/Functional/DiscoveryEndpointResponseTests.cs +++ b/test/HealthChecks.OpenIdConnectServer.Tests/Functional/DiscoveryEndpointResponseTests.cs @@ -81,7 +81,7 @@ public void be_invalid_when_combined_response_types_supported_are_missing() Issuer = RandomString, AuthorizationEndpoint = RandomString, JwksUri = RandomString, - ResponseTypesSupported = new[] { "id_token", "code" }, + ResponseTypesSupported = ["id_token", "code"], }; Action validate = () => response.ValidateResponse(); @@ -102,7 +102,7 @@ public void be_invalid_when_required_subject_types_supported_are_missing(string AuthorizationEndpoint = RandomString, JwksUri = RandomString, ResponseTypesSupported = REQUIRED_RESPONSE_TYPES, - SubjectTypesSupported = new[] { subjectTypesSupported }, + SubjectTypesSupported = [subjectTypesSupported], }; Action validate = () => response.ValidateResponse(); @@ -122,7 +122,7 @@ public void be_invalid_when_required_id_token_signing_alg_values_supported_is_mi JwksUri = RandomString, ResponseTypesSupported = REQUIRED_RESPONSE_TYPES, SubjectTypesSupported = OidcConstants.REQUIRED_SUBJECT_TYPES, - SigningAlgorithmsSupported = new[] { string.Empty }, + SigningAlgorithmsSupported = [string.Empty], }; Action validate = () => response.ValidateResponse(); @@ -152,5 +152,5 @@ public void be_valid_when_all_required_values_are_provided() private static string RandomString => Guid.NewGuid().ToString(); - private static readonly string[] REQUIRED_RESPONSE_TYPES = OidcConstants.REQUIRED_RESPONSE_TYPES.Concat(new[] { "id_token token" }).ToArray(); + private static readonly string[] REQUIRED_RESPONSE_TYPES = OidcConstants.REQUIRED_RESPONSE_TYPES.Concat(["id_token token"]).ToArray(); } diff --git a/test/HealthChecks.OpenIdConnectServer.Tests/Functional/IdSvrHealthCheckTests.cs b/test/HealthChecks.OpenIdConnectServer.Tests/Functional/IdSvrHealthCheckTests.cs index d4b8b6e478..3f41837059 100644 --- a/test/HealthChecks.OpenIdConnectServer.Tests/Functional/IdSvrHealthCheckTests.cs +++ b/test/HealthChecks.OpenIdConnectServer.Tests/Functional/IdSvrHealthCheckTests.cs @@ -11,7 +11,7 @@ public async Task be_unhealthy_if_idsvr_is_unavailable() .ConfigureServices(services => { services.AddHealthChecks() - .AddIdentityServer(new Uri("http://localhost:7777"), tags: new string[] { "idsvr" }); + .AddIdentityServer(new Uri("http://localhost:7777"), tags: ["idsvr"]); }) .Configure(app => { @@ -35,7 +35,7 @@ public async Task be_healthy_if_idsvr_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddIdentityServer(new Uri("http://localhost:8888"), tags: new string[] { "idsvr" }); + .AddIdentityServer(new Uri("http://localhost:8888"), tags: ["idsvr"]); }) .Configure(app => { diff --git a/test/HealthChecks.Oracle.Tests/Functional/OracleHealthCheckTests.cs b/test/HealthChecks.Oracle.Tests/Functional/OracleHealthCheckTests.cs index 8b6631f1b2..aa311f86b8 100644 --- a/test/HealthChecks.Oracle.Tests/Functional/OracleHealthCheckTests.cs +++ b/test/HealthChecks.Oracle.Tests/Functional/OracleHealthCheckTests.cs @@ -15,7 +15,7 @@ public async Task be_healthy_when_oracle_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddOracle(connectionString, tags: new string[] { "oracle" }); + .AddOracle(connectionString, tags: ["oracle"]); }) .Configure(app => { @@ -40,7 +40,7 @@ public async Task be_unhealthy_when_oracle_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddOracle(connectionString, tags: new string[] { "oracle" }); + .AddOracle(connectionString, tags: ["oracle"]); }) .Configure(app => { @@ -63,7 +63,7 @@ public async Task be_unhealthy_when_sql_query_is_not_valid() .ConfigureServices(services => { services.AddHealthChecks() - .AddOracle(connectionString, "SELECT 1 FROM InvalidDb", tags: new string[] { "oracle" }); + .AddOracle(connectionString, "SELECT 1 FROM InvalidDb", tags: ["oracle"]); }) .Configure(app => { @@ -94,7 +94,7 @@ public async Task be_healthy_with_connection_string_factory_when_oracle_is_avail factoryCalled = true; return connectionString; - }, tags: new string[] { "oracle" }); + }, tags: ["oracle"]); }) .Configure(app => { @@ -124,7 +124,7 @@ public async Task be_healthy_with_connection_string_and_credential_when_oracle_i { services .AddHealthChecks() - .AddOracle(connectionString, tags: new string[] { "oracle" }, + .AddOracle(connectionString, tags: ["oracle"], configure: options => { factoryCalled = true; diff --git a/test/HealthChecks.RabbitMQ.Tests/Functional/RabbitHealthCheckTests.cs b/test/HealthChecks.RabbitMQ.Tests/Functional/RabbitHealthCheckTests.cs index 07c09d7713..8ddbdbd8e2 100644 --- a/test/HealthChecks.RabbitMQ.Tests/Functional/RabbitHealthCheckTests.cs +++ b/test/HealthChecks.RabbitMQ.Tests/Functional/RabbitHealthCheckTests.cs @@ -14,7 +14,7 @@ public async Task be_healthy_if_rabbitmq_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddRabbitMQ(rabbitConnectionString: connectionString, tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(rabbitConnectionString: connectionString, tags: ["rabbitmq"]); }) .Configure(app => { @@ -40,7 +40,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_ssloption() .ConfigureServices(services => { services.AddHealthChecks() - .AddRabbitMQ(rabbitConnectionString: connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(rabbitConnectionString: connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: ["rabbitmq"]); }) .Configure(app => { @@ -64,7 +64,7 @@ public async Task be_unhealthy_if_rabbitmq_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddRabbitMQ("amqp://localhost:6672", sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); + .AddRabbitMQ("amqp://localhost:6672", sslOption: new SslOption(serverName: "localhost", enabled: false), tags: ["rabbitmq"]); }) .Configure(app => { @@ -98,7 +98,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iconnectionfactory() { services .AddHealthChecks() - .AddRabbitMQ(options => options.ConnectionFactory = factory, tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(options => options.ConnectionFactory = factory, tags: ["rabbitmq"]); }) .Configure(app => { @@ -135,7 +135,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iconnection() services .AddSingleton(connection) .AddHealthChecks() - .AddRabbitMQ(tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(tags: ["rabbitmq"]); }) .Configure(app => { @@ -161,7 +161,7 @@ public async Task be_healthy_if_rabbitmq_is_available_and_specify_default_sslopt .ConfigureServices(services => { services.AddHealthChecks() - .AddRabbitMQ(connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: ["rabbitmq"]); }) .Configure(app => { @@ -195,7 +195,7 @@ public async Task be_not_crash_on_startup_when_rabbitmq_is_down_at_startup() }; }) .AddHealthChecks() - .AddRabbitMQ(tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(tags: ["rabbitmq"]); }) .Configure(app => { @@ -221,7 +221,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iServiceProvider() { services .AddHealthChecks() - .AddRabbitMQ(options => options.ConnectionUri = new Uri(connectionString), tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(options => options.ConnectionUri = new Uri(connectionString), tags: ["rabbitmq"]); }) .Configure(app => diff --git a/test/HealthChecks.RavenDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.RavenDb.Tests/DependencyInjection/RegistrationTests.cs index 3dda1fc6ad..1a7872b9be 100644 --- a/test/HealthChecks.RavenDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.RavenDb.Tests/DependencyInjection/RegistrationTests.cs @@ -9,7 +9,7 @@ public void add_health_check_when_properly_configured() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddRavenDB(_ => _.Urls = new[] { "http://localhost:8080", "http://localhost:8081" }); + .AddRavenDB(_ => _.Urls = ["http://localhost:8080", "http://localhost:8081"]); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -26,7 +26,7 @@ public void add_named_health_check_when_properly_configured() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddRavenDB(_ => _.Urls = new[] { "http://localhost:8080", "http://localhost:8081" }, + .AddRavenDB(_ => _.Urls = ["http://localhost:8080", "http://localhost:8081"], name: "my-ravendb"); using var serviceProvider = services.BuildServiceProvider(); @@ -44,7 +44,7 @@ public void add_health_check_when_properly_configured_single_connection() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddRavenDB(setup => setup.Urls = new[] { "http://localhost:8080" }); + .AddRavenDB(setup => setup.Urls = ["http://localhost:8080"]); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -61,7 +61,7 @@ public void add_named_health_check_when_properly_configured_single_connection() { var services = new ServiceCollection(); services.AddHealthChecks() - .AddRavenDB(setup => setup.Urls = new[] { "http://localhost:8080" }, name: "my-ravendb"); + .AddRavenDB(setup => setup.Urls = ["http://localhost:8080"], name: "my-ravendb"); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); diff --git a/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTests.cs b/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTests.cs index 79bb3fe69b..cb43783eb1 100644 --- a/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTests.cs +++ b/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTests.cs @@ -8,7 +8,7 @@ namespace HealthChecks.RavenDb.Tests.Functional; public class ravendb_healthcheck_should { - private readonly string[] _urls = new[] { "http://localhost:9030" }; + private readonly string[] _urls = ["http://localhost:9030"]; public ravendb_healthcheck_should() { @@ -34,7 +34,7 @@ public async Task be_healthy_if_ravendb_is_available() { services .AddHealthChecks() - .AddRavenDB(_ => _.Urls = _urls, tags: new string[] { "ravendb" }); + .AddRavenDB(_ => _.Urls = _urls, tags: ["ravendb"]); }) .Configure(app => { @@ -64,7 +64,7 @@ public async Task be_healthy_if_ravendb_is_available_and_contains_specific_datab { _.Urls = _urls; _.Database = "Demo"; - }, tags: new string[] { "ravendb" }); + }, tags: ["ravendb"]); }) .Configure(app => { @@ -95,7 +95,7 @@ public async Task be_unhealthy_if_ravendb_is_available_but_timeout_is_too_low() _.Urls = _urls; _.Database = "Demo"; _.RequestTimeout = TimeSpan.FromMilliseconds(0.001); - }, tags: new string[] { "ravendb" }); + }, tags: ["ravendb"]); }) .Configure(app => { @@ -123,7 +123,7 @@ public async Task be_unhealthy_if_ravendb_is_not_available() { services .AddHealthChecks() - .AddRavenDB(_ => _.Urls = new string[] { connectionString }, tags: new string[] { "ravendb" }); + .AddRavenDB(_ => _.Urls = [connectionString], tags: ["ravendb"]); }) .Configure(app => { @@ -153,7 +153,7 @@ public async Task be_unhealthy_if_ravendb_is_available_but_database_doesnot_exis { _.Urls = _urls; _.Database = "ThisDatabaseReallyDoesnExist"; - }, tags: new string[] { "ravendb" }); + }, tags: ["ravendb"]); }) .Configure(app => { diff --git a/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTestsSingleConnectionString.cs b/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTestsSingleConnectionString.cs index 4505499cdc..d9d35165e4 100644 --- a/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTestsSingleConnectionString.cs +++ b/test/HealthChecks.RavenDb.Tests/Functional/RavenDbHealthCheckTestsSingleConnectionString.cs @@ -15,7 +15,7 @@ public ravendb_healthcheck_should_single_connection_string() { using var store = new DocumentStore { - Urls = new string[] { ConnectionString }, + Urls = [ConnectionString], }; store.Initialize(); @@ -33,7 +33,7 @@ public async Task be_healthy_if_ravendb_is_available() { services .AddHealthChecks() - .AddRavenDB(setup => setup.Urls = new[] { ConnectionString }, tags: new string[] { "ravendb" }); + .AddRavenDB(setup => setup.Urls = [ConnectionString], tags: ["ravendb"]); }) .Configure(app => { @@ -58,7 +58,7 @@ public async Task be_healthy_if_ravendb_is_available_and_contains_specific_datab { services .AddHealthChecks() - .AddRavenDB(setup => setup.Urls = new[] { ConnectionString }, "Demo", tags: new string[] { "ravendb" }); + .AddRavenDB(setup => setup.Urls = [ConnectionString], "Demo", tags: ["ravendb"]); }) .Configure(app => { @@ -85,7 +85,7 @@ public async Task be_unhealthy_if_ravendb_is_not_available() { services .AddHealthChecks() - .AddRavenDB(setup => setup.Urls = new[] { connectionString }, tags: new string[] { "ravendb" }); + .AddRavenDB(setup => setup.Urls = [connectionString], tags: ["ravendb"]); }) .Configure(app => { @@ -112,9 +112,9 @@ public async Task be_unhealthy_if_ravendb_is_available_but_database_doesnot_exis .AddHealthChecks() .AddRavenDB(setup => { - setup.Urls = new[] { ConnectionString }; + setup.Urls = [ConnectionString]; setup.Database = "ThisDatabaseReallyDoesnExist"; - }, "ThisDatabaseReallyDoesnExist", tags: new string[] { "ravendb" }); + }, "ThisDatabaseReallyDoesnExist", tags: ["ravendb"]); }) .Configure(app => { diff --git a/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs b/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs index 8e3b9a632d..3e6b19a0af 100644 --- a/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs +++ b/test/HealthChecks.Redis.Tests/Functional/RedisHealthCheckTests.cs @@ -16,7 +16,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_string() .ConfigureServices(services => { services.AddHealthChecks() - .AddRedis(connectionString, tags: new string[] { "redis" }); + .AddRedis(connectionString, tags: ["redis"]); }) .Configure(app => { @@ -42,8 +42,8 @@ public async Task be_healthy_if_multiple_redis_are_available_with_connection_str .ConfigureServices(services => { services.AddHealthChecks() - .AddRedis(connectionString, tags: new string[] { "redis" }, name: "1") - .AddRedis(connectionString, tags: new string[] { "redis" }, name: "2"); + .AddRedis(connectionString, tags: ["redis"], name: "1") + .AddRedis(connectionString, tags: ["redis"], name: "2"); }) .Configure(app => { @@ -70,7 +70,7 @@ public async Task be_healthy_if_redis_is_available_with_connection_multiplexer() .ConfigureServices(services => { services.AddHealthChecks() - .AddRedis(connectionMultiplexer, tags: new string[] { "redis" }); + .AddRedis(connectionMultiplexer, tags: ["redis"]); }) .Configure(app => { @@ -99,8 +99,8 @@ public async Task be_healthy_if_multiple_redis_are_available_with_connection_mul services.AddSingleton(connectionMultiplexer); services.AddHealthChecks() - .AddRedis(connectionMultiplexer, tags: new string[] { "redis" }, name: "1") - .AddRedis(sp => sp.GetRequiredService(), tags: new string[] { "redis" }, name: "2"); + .AddRedis(connectionMultiplexer, tags: ["redis"], name: "1") + .AddRedis(sp => sp.GetRequiredService(), tags: ["redis"], name: "2"); }) .Configure(app => { @@ -152,7 +152,7 @@ public async Task be_unhealthy_if_redis_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddRedis("nonexistinghost:6379,allowAdmin=true", tags: new string[] { "redis" }); + .AddRedis("nonexistinghost:6379,allowAdmin=true", tags: ["redis"]); }) .Configure(app => { @@ -176,7 +176,7 @@ public async Task be_unhealthy_if_redis_is_not_available_within_specified_timeou .ConfigureServices(services => { services.AddHealthChecks() - .AddRedis("nonexistinghost:6379,allowAdmin=true,connectRetry=2147483647", tags: new string[] { "redis" }, timeout: TimeSpan.FromSeconds(2)); + .AddRedis("nonexistinghost:6379,allowAdmin=true,connectRetry=2147483647", tags: ["redis"], timeout: TimeSpan.FromSeconds(2)); }) .Configure(app => { @@ -222,7 +222,7 @@ public async Task not_every_IConnectionMultiplexer_is_ConnectionMultiplexer() private sealed class NotConnectionMultiplexer : IConnectionMultiplexer { // it returns an empty array of endpoints, so nothing should get checked and OK should be returned by the health check - public EndPoint[] GetEndPoints(bool configuredOnly = false) => Array.Empty(); + public EndPoint[] GetEndPoints(bool configuredOnly = false) => []; #pragma warning disable CS0067 public override string ToString() => "stop complaining about Nullability"; diff --git a/test/HealthChecks.SignalR.Tests/Functional/SignalRHealthCheckTests.cs b/test/HealthChecks.SignalR.Tests/Functional/SignalRHealthCheckTests.cs index 764e6a05cf..bc3c3e8163 100644 --- a/test/HealthChecks.SignalR.Tests/Functional/SignalRHealthCheckTests.cs +++ b/test/HealthChecks.SignalR.Tests/Functional/SignalRHealthCheckTests.cs @@ -21,7 +21,7 @@ public async Task be_healthy_if_signalr_hub_is_available() () => new HubConnectionBuilder() .WithUrl("http://localhost/test", o => o.HttpMessageHandlerFactory = _ => server.CreateHandler()) .Build(), - tags: new string[] { "signalr" }); + tags: ["signalr"]); }) .Configure(app => { @@ -59,7 +59,7 @@ public async Task be_unhealthy_if_signalr_hub_is_unavailable() () => new HubConnectionBuilder() .WithUrl("http://localhost/badhub", o => o.HttpMessageHandlerFactory = _ => server.CreateHandler()) .Build(), - tags: new string[] { "signalr" }); + tags: ["signalr"]); }) .Configure(app => { diff --git a/test/HealthChecks.Solr.Tests/Functional/SolrHealthCheckTests.cs b/test/HealthChecks.Solr.Tests/Functional/SolrHealthCheckTests.cs index 8a419a8dc4..d9697dce1d 100644 --- a/test/HealthChecks.Solr.Tests/Functional/SolrHealthCheckTests.cs +++ b/test/HealthChecks.Solr.Tests/Functional/SolrHealthCheckTests.cs @@ -12,7 +12,7 @@ public async Task be_healthy_if_solr_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddSolr("http://localhost:8983/solr", "solrcore", tags: new string[] { "solr" }); + .AddSolr("http://localhost:8983/solr", "solrcore", tags: ["solr"]); }) .Configure(app => { @@ -35,7 +35,7 @@ public async Task be_unhealthy_if_solr_ping_is_disabled() .ConfigureServices(services => { services.AddHealthChecks() - .AddSolr("http://localhost:8893/solr", "solrcoredown", tags: new string[] { "solr" }); + .AddSolr("http://localhost:8893/solr", "solrcoredown", tags: ["solr"]); }) .Configure(app => { @@ -58,7 +58,7 @@ public async Task be_unhealthy_if_solr_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddSolr("http://200.0.0.100:8893", "core", tags: new string[] { "solr" }); + .AddSolr("http://200.0.0.100:8893", "core", tags: ["solr"]); }) .Configure(app => { diff --git a/test/HealthChecks.SqlServer.Tests/Functional/SqlServerHealthCheckTests.cs b/test/HealthChecks.SqlServer.Tests/Functional/SqlServerHealthCheckTests.cs index 8a61bd7870..bc04019e8c 100644 --- a/test/HealthChecks.SqlServer.Tests/Functional/SqlServerHealthCheckTests.cs +++ b/test/HealthChecks.SqlServer.Tests/Functional/SqlServerHealthCheckTests.cs @@ -13,7 +13,7 @@ public async Task be_healthy_if_sqlServer_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlServer(connectionString, tags: new string[] { "sqlserver" }); + .AddSqlServer(connectionString, tags: ["sqlserver"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_unhealthy_if_sqlServer_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlServer("Server=tcp:localhost,1833;Initial Catalog=master;User Id=sa;Password=Password12!;Encrypt=false;Connection Timeout=10", tags: new string[] { "sqlserver" }); + .AddSqlServer("Server=tcp:localhost,1833;Initial Catalog=master;User Id=sa;Password=Password12!;Encrypt=false;Connection Timeout=10", tags: ["sqlserver"]); }) .Configure(app => { @@ -63,7 +63,7 @@ public async Task be_unhealthy_if_sqlquery_spec_is_not_valid() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlServer(connectionString, healthQuery: "SELECT 1 FROM [NOT_VALID_DB]", tags: new string[] { "sqlserver" }); + .AddSqlServer(connectionString, healthQuery: "SELECT 1 FROM [NOT_VALID_DB]", tags: ["sqlserver"]); }) .Configure(app => { diff --git a/test/HealthChecks.Sqlite.Tests/Functional/SqliteHealthCheckTests.cs b/test/HealthChecks.Sqlite.Tests/Functional/SqliteHealthCheckTests.cs index 8553bedf77..0bef627fb0 100644 --- a/test/HealthChecks.Sqlite.Tests/Functional/SqliteHealthCheckTests.cs +++ b/test/HealthChecks.Sqlite.Tests/Functional/SqliteHealthCheckTests.cs @@ -11,7 +11,7 @@ public async void be_healthy_when_sqlite_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlite($"Data Source=sqlite.db", healthQuery: "select name from sqlite_master where type='table'", tags: new string[] { "sqlite" }); + .AddSqlite($"Data Source=sqlite.db", healthQuery: "select name from sqlite_master where type='table'", tags: ["sqlite"]); }) .Configure(app => { @@ -35,7 +35,7 @@ public async Task be_unhealthy_when_sqlite_is_unavailable() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlite($"Data Source=fake.db", healthQuery: "select * from Users", tags: new string[] { "sqlite" }); + .AddSqlite($"Data Source=fake.db", healthQuery: "select * from Users", tags: ["sqlite"]); }) .Configure(app => { @@ -59,7 +59,7 @@ public async void be_unhealthy_when_sqlquery_is_not_valid() .ConfigureServices(services => { services.AddHealthChecks() - .AddSqlite($"Data Source=sqlite.db", healthQuery: "select name from invaliddb", tags: new string[] { "sqlite" }); + .AddSqlite($"Data Source=sqlite.db", healthQuery: "select name from invaliddb", tags: ["sqlite"]); }) .Configure(app => { diff --git a/test/HealthChecks.System.Tests/Functional/DiskStorageHealthCheckTests.cs b/test/HealthChecks.System.Tests/Functional/DiskStorageHealthCheckTests.cs index 80c5ce3d58..a096c47ade 100644 --- a/test/HealthChecks.System.Tests/Functional/DiskStorageHealthCheckTests.cs +++ b/test/HealthChecks.System.Tests/Functional/DiskStorageHealthCheckTests.cs @@ -19,7 +19,7 @@ public async Task be_healthy_when_disks_have_more_free_space_than_configured() .ConfigureServices(services => { services.AddHealthChecks() - .AddDiskStorageHealthCheck(setup => setup.AddDrive(testDrive.Name, targetFreeSpace), tags: new string[] { "diskstorage" }); + .AddDiskStorageHealthCheck(setup => setup.AddDrive(testDrive.Name, targetFreeSpace), tags: ["diskstorage"]); }) .Configure(app => { @@ -47,7 +47,7 @@ public async Task be_unhealthy_when_a_disk_has_less_free_space_than_configured() .ConfigureServices(services => { services.AddHealthChecks() - .AddDiskStorageHealthCheck(setup => setup.AddDrive(testDrive.Name, targetFreeSpace), tags: new string[] { "diskstorage" }); + .AddDiskStorageHealthCheck(setup => setup.AddDrive(testDrive.Name, targetFreeSpace), tags: ["diskstorage"]); }) .Configure(app => { @@ -70,7 +70,7 @@ public async Task be_unhealthy_when_a_configured_disk_does_not_exist() .ConfigureServices(services => { services.AddHealthChecks() - .AddDiskStorageHealthCheck(setup => setup.AddDrive("nonexistingdisk", 104857600), tags: new string[] { "diskstorage" }); + .AddDiskStorageHealthCheck(setup => setup.AddDrive("nonexistingdisk", 104857600), tags: ["diskstorage"]); }) .Configure(app => { diff --git a/test/HealthChecks.System.Tests/Functional/FileHealthCheckTests.cs b/test/HealthChecks.System.Tests/Functional/FileHealthCheckTests.cs index 3aa7d5c3db..8787371c7f 100644 --- a/test/HealthChecks.System.Tests/Functional/FileHealthCheckTests.cs +++ b/test/HealthChecks.System.Tests/Functional/FileHealthCheckTests.cs @@ -11,7 +11,7 @@ public async Task be_healthy_if_file_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddFile(setup => setup.AddFile(Path.Combine(Directory.GetCurrentDirectory(), "HealthChecks.System.Tests.dll")), tags: new string[] { "file" }); + .AddFile(setup => setup.AddFile(Path.Combine(Directory.GetCurrentDirectory(), "HealthChecks.System.Tests.dll")), tags: ["file"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_healthy_if_no_file_provided() services.AddHealthChecks() .AddFile(setup => { - }, tags: new string[] { "file" }); + }, tags: ["file"]); }) .Configure(app => { @@ -61,7 +61,7 @@ public async Task be_unhealthy_if_file_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddFile(setup => setup.AddFile($"{Directory.GetCurrentDirectory()}/non-existing-file"), tags: new string[] { "file" }); + .AddFile(setup => setup.AddFile($"{Directory.GetCurrentDirectory()}/non-existing-file"), tags: ["file"]); }) .Configure(app => { diff --git a/test/HealthChecks.System.Tests/Functional/FolderHealthCheckTests.cs b/test/HealthChecks.System.Tests/Functional/FolderHealthCheckTests.cs index 02249415cd..0835ac2597 100644 --- a/test/HealthChecks.System.Tests/Functional/FolderHealthCheckTests.cs +++ b/test/HealthChecks.System.Tests/Functional/FolderHealthCheckTests.cs @@ -11,7 +11,7 @@ public async Task be_healthy_if_folder_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddFolder(setup => setup.AddFolder(Directory.GetCurrentDirectory()), tags: new string[] { "folder" }); + .AddFolder(setup => setup.AddFolder(Directory.GetCurrentDirectory()), tags: ["folder"]); }) .Configure(app => { @@ -37,7 +37,7 @@ public async Task be_healthy_if_no_folder_provided() services.AddHealthChecks() .AddFolder(setup => { - }, tags: new string[] { "folder" }); + }, tags: ["folder"]); }) .Configure(app => { @@ -61,7 +61,7 @@ public async Task be_unhealthy_if_folder_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddFolder(setup => setup.AddFolder($"{Directory.GetCurrentDirectory()}/non-existing-folder"), tags: new string[] { "folder" }); + .AddFolder(setup => setup.AddFolder($"{Directory.GetCurrentDirectory()}/non-existing-folder"), tags: ["folder"]); }) .Configure(app => { diff --git a/test/HealthChecks.System.Tests/Functional/MemoryHealthCheckTests.cs b/test/HealthChecks.System.Tests/Functional/MemoryHealthCheckTests.cs index b7dfd62c93..82f0324063 100644 --- a/test/HealthChecks.System.Tests/Functional/MemoryHealthCheckTests.cs +++ b/test/HealthChecks.System.Tests/Functional/MemoryHealthCheckTests.cs @@ -18,7 +18,7 @@ public async Task be_healthy_when_private_memory_does_not_exceed_the_maximum_est .ConfigureServices(services => { services.AddHealthChecks() - .AddPrivateMemoryHealthCheck(maximumMemory, tags: new string[] { "privatememory" }); + .AddPrivateMemoryHealthCheck(maximumMemory, tags: ["privatememory"]); }) .Configure(app => { @@ -43,7 +43,7 @@ public async Task be_unhealthy_when_private_memory_does_exceed_the_maximum_estab .ConfigureServices(services => { services.AddHealthChecks() - .AddPrivateMemoryHealthCheck(maximumMemory, tags: new string[] { "privatememory" }); + .AddPrivateMemoryHealthCheck(maximumMemory, tags: ["privatememory"]); }) .Configure(app => { @@ -68,7 +68,7 @@ public async Task be_healthy_when_workingset_does_not_exceed_the_maximum_establi .ConfigureServices(services => { services.AddHealthChecks() - .AddWorkingSetHealthCheck(maximumMemory, tags: new string[] { "workingset" }); + .AddWorkingSetHealthCheck(maximumMemory, tags: ["workingset"]); }) .Configure(app => { @@ -93,7 +93,7 @@ public async Task be_unhealthy_when_workingset_does_exceed_the_maximum_establish .ConfigureServices(services => { services.AddHealthChecks() - .AddPrivateMemoryHealthCheck(maximumMemory, tags: new string[] { "privatememory" }); + .AddPrivateMemoryHealthCheck(maximumMemory, tags: ["privatememory"]); }) .Configure(app => { @@ -118,7 +118,7 @@ public async Task be_healthy_when_virtual_memory_size_does_not_exceed_the_maximu .ConfigureServices(services => { services.AddHealthChecks() - .AddVirtualMemorySizeHealthCheck(maximumMemory, tags: new string[] { "virtualmemory" }); + .AddVirtualMemorySizeHealthCheck(maximumMemory, tags: ["virtualmemory"]); }) .Configure(app => { @@ -143,7 +143,7 @@ public async Task be_unhealthy_when_virtual_memory_size_does_exceed_the_maximum_ .ConfigureServices(services => { services.AddHealthChecks() - .AddVirtualMemorySizeHealthCheck(maximumMemory, tags: new string[] { "virtualmemory" }); + .AddVirtualMemorySizeHealthCheck(maximumMemory, tags: ["virtualmemory"]); }) .Configure(app => { diff --git a/test/HealthChecks.System.Tests/Seedwork/SkipOnPlattform.cs b/test/HealthChecks.System.Tests/Seedwork/SkipOnPlattform.cs index 1c7fa7f64e..08494b8fb2 100644 --- a/test/HealthChecks.System.Tests/Seedwork/SkipOnPlattform.cs +++ b/test/HealthChecks.System.Tests/Seedwork/SkipOnPlattform.cs @@ -39,10 +39,7 @@ public IEnumerable Discover(ITestFrameworkDiscoveryOptions disco } } - return new[] - { - new XunitTestCase(_diagnosticMessageSink, TestMethodDisplay.Method, TestMethodDisplayOptions.All ,testMethod) - }; + return [new XunitTestCase(_diagnosticMessageSink, TestMethodDisplay.Method, TestMethodDisplayOptions.All, testMethod)]; } } diff --git a/test/HealthChecks.Uris.Tests/Functional/UrisHealthCheckTests.cs b/test/HealthChecks.Uris.Tests/Functional/UrisHealthCheckTests.cs index ac0e7839c6..2ad782cdcd 100644 --- a/test/HealthChecks.Uris.Tests/Functional/UrisHealthCheckTests.cs +++ b/test/HealthChecks.Uris.Tests/Functional/UrisHealthCheckTests.cs @@ -48,7 +48,7 @@ public async Task be_healthy_if_uri_is_available() .AddUrlGroup( uri, configurePrimaryHttpMessageHandler: _ => new DelayStubMessageHandler(TimeSpan.Zero), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -77,7 +77,7 @@ public async Task be_healthy_if_method_is_available() uri, HttpMethod.Post, configurePrimaryHttpMessageHandler: _ => new DelayStubMessageHandler(TimeSpan.Zero), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -102,7 +102,7 @@ public async Task be_unhealthy_if_uri_is_not_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddUrlGroup(uri, tags: new string[] { "uris" }); + .AddUrlGroup(uri, tags: ["uris"]); }) .Configure(app => { @@ -128,7 +128,7 @@ public async Task be_unhealthy_if_status_code_is_error(int statusCode) .ConfigureServices(services => { services.AddHealthChecks() - .AddUrlGroup(uri, tags: new string[] { "uris" }); + .AddUrlGroup(uri, tags: ["uris"]); }) .Configure(app => { @@ -154,7 +154,7 @@ public async Task be_unhealthy_if_request_is_timeout() services.AddHealthChecks() .AddUrlGroup( opt => opt.AddUri(uri, options => options.UseTimeout(TimeSpan.FromSeconds(1))), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -185,7 +185,7 @@ public async Task be_unhealthy_if_request_is_timeout_using_default_timeout() opt.AddUri(uri); }, configurePrimaryHttpMessageHandler: _ => new DelayStubMessageHandler(TimeSpan.FromSeconds(11)), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -213,7 +213,7 @@ public async Task be_healthy_if_request_success_and_timeout_is_configured() .AddUrlGroup( opt => opt.AddUri(uri, options => options.UseTimeout(TimeSpan.FromSeconds(3))), configurePrimaryHttpMessageHandler: _ => new DelayStubMessageHandler(TimeSpan.FromSeconds(2)), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -246,7 +246,7 @@ public async Task be_healthy_if_request_success_and_default_timeout_is_configure opt.AddUri(uri); }, configurePrimaryHttpMessageHandler: _ => new DelayStubMessageHandler(TimeSpan.FromSeconds(2)), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -274,7 +274,7 @@ public async Task be_healthy_if_request_succeeds_and_expected_response_matches() .AddUrlGroup( opt => opt.AddUri(uri, options => options.ExpectContent("abc")), configurePrimaryHttpMessageHandler: _ => new ContentStubMessageHandler("abc"), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { @@ -301,7 +301,7 @@ public async Task be_unhealthy_if_request_succeeds_and_expected_response_fails() .AddUrlGroup( opt => opt.AddUri(uri, options => options.ExpectContent("xyz")), configurePrimaryHttpMessageHandler: _ => new ContentStubMessageHandler("abc"), - tags: new string[] { "uris" }); + tags: ["uris"]); }) .Configure(app => { diff --git a/test/_SHARED/ApiApprovalTests.cs b/test/_SHARED/ApiApprovalTests.cs index a79a63087d..639286f53d 100644 --- a/test/_SHARED/ApiApprovalTests.cs +++ b/test/_SHARED/ApiApprovalTests.cs @@ -25,7 +25,7 @@ public void public_api_should_not_change_unintentionally() string publicApi = asmForTest.GeneratePublicApi(new() { IncludeAssemblyAttributes = false, - AllowNamespacePrefixes = new[] { "Microsoft" } + AllowNamespacePrefixes = ["Microsoft"] }); var location = Assembly.GetExecutingAssembly().Location; diff --git a/test/_SHARED/ConformanceTests.cs b/test/_SHARED/ConformanceTests.cs index 6d2aab48fd..6cbd465361 100644 --- a/test/_SHARED/ConformanceTests.cs +++ b/test/_SHARED/ConformanceTests.cs @@ -94,7 +94,7 @@ public async Task DependencyInjectionRegistrationWorksAsExpected(HealthStatus fa { const string healthCheckName = "random_name"; var timeout = TimeSpan.FromSeconds(5); - string[] tags = { "a", "b", "c" }; + string[] tags = ["a", "b", "c"]; int counter = 0; ServiceCollection services = new();