From 43e46f446cf4cf73e0e5b1a820d28749db425008 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 11 Oct 2023 13:00:38 -0400 Subject: [PATCH] Fix RC2 analyzer warnings --- .../HasUnwrappedSagaListenerRegistered.cs | 2 +- src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs | 2 +- .../When_using_multitenant_dbs_with_Outbox.cs | 2 +- .../ConfigureEndpointRavenDBPersistence.cs | 2 +- .../ReusableDbConfig.cs | 2 +- .../ConfigureEndpointRavenDBPersistence.cs | 2 +- .../PersistenceTestsConfiguration.cs | 2 +- src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs | 4 ++-- src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs | 6 +++--- .../Infrastructure/StoreSnooper.cs | 2 +- src/NServiceBus.RavenDB.Tests/RavenDBPersistenceTestBase.cs | 2 +- .../Internal/DocumentStoreInitializer.cs | 2 +- src/NServiceBus.RavenDB/Subscriptions/Subscription.cs | 2 +- .../Subscriptions/SubscriptionPersister.cs | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/NServiceBus.RavenDB.AcceptanceTests/HasUnwrappedSagaListenerRegistered.cs b/src/NServiceBus.RavenDB.AcceptanceTests/HasUnwrappedSagaListenerRegistered.cs index a0bfe1a40..ceef455a2 100644 --- a/src/NServiceBus.RavenDB.AcceptanceTests/HasUnwrappedSagaListenerRegistered.cs +++ b/src/NServiceBus.RavenDB.AcceptanceTests/HasUnwrappedSagaListenerRegistered.cs @@ -84,7 +84,7 @@ public class OrderSagaData : ContainSagaData { public string OrderId { get; set; } public int ContinueCount { get; set; } - public List CollectedIndexes { get; set; } = new List(); + public List CollectedIndexes { get; set; } = []; } } diff --git a/src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs b/src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs index 1bd0c664f..a668ad95e 100644 --- a/src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs +++ b/src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs @@ -102,7 +102,7 @@ public class OrderSagaData : ContainSagaData { public string OrderId { get; set; } public int ContinueCount { get; set; } - public List CollectedIndexes { get; set; } = new List(); + public List CollectedIndexes { get; set; } = []; } } diff --git a/src/NServiceBus.RavenDB.AcceptanceTests/When_using_multitenant_dbs_with_Outbox.cs b/src/NServiceBus.RavenDB.AcceptanceTests/When_using_multitenant_dbs_with_Outbox.cs index 4ae3b4af6..397b10597 100644 --- a/src/NServiceBus.RavenDB.AcceptanceTests/When_using_multitenant_dbs_with_Outbox.cs +++ b/src/NServiceBus.RavenDB.AcceptanceTests/When_using_multitenant_dbs_with_Outbox.cs @@ -123,7 +123,7 @@ public class Context : ScenarioContext public string DefaultDb { get; set; } public string Db1 { get; set; } public string Db2 { get; set; } - public List ObservedDbs { get; } = new List(); + public List ObservedDbs { get; } = []; public string ObservedDbsOutput => string.Join(", ", ObservedDbs); public ContextDbConfig DbConfig { get; } = new ContextDbConfig(); public int MessagesObserved; diff --git a/src/NServiceBus.RavenDB.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs b/src/NServiceBus.RavenDB.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs index 67347bfa7..8a6a3a0e8 100644 --- a/src/NServiceBus.RavenDB.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs +++ b/src/NServiceBus.RavenDB.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs @@ -66,7 +66,7 @@ public static Task CreateDatabase(IDocumentStore defaultStore, string dbName, Ca { var dbRecord = new DatabaseRecord(dbName) { - Topology = new DatabaseTopology { Members = new List { "A", "B", "C" } } + Topology = new DatabaseTopology { Members = ["A", "B", "C"] } }; return defaultStore.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRecord, 3), cancellationToken); diff --git a/src/NServiceBus.RavenDB.ClusterWide.Tests/ReusableDbConfig.cs b/src/NServiceBus.RavenDB.ClusterWide.Tests/ReusableDbConfig.cs index 3878218b6..8dfc2f7f6 100644 --- a/src/NServiceBus.RavenDB.ClusterWide.Tests/ReusableDbConfig.cs +++ b/src/NServiceBus.RavenDB.ClusterWide.Tests/ReusableDbConfig.cs @@ -17,7 +17,7 @@ public async Task EnsureDatabaseExists(IDocumentStore store, CancellationToken c // to the server ever attempting to ensure its existence means we can rely on it. var dbRecord = new DatabaseRecord(databaseName) { - Topology = new DatabaseTopology() { Members = new List { "A", "B", "C" } } + Topology = new DatabaseTopology() { Members = ["A", "B", "C"] } }; await store.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRecord), cancellationToken); Console.WriteLine($"Provisioned new Raven database name {databaseName}"); diff --git a/src/NServiceBus.RavenDB.Optimistic.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs b/src/NServiceBus.RavenDB.Optimistic.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs index bcad79ecb..712c81ee1 100644 --- a/src/NServiceBus.RavenDB.Optimistic.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs +++ b/src/NServiceBus.RavenDB.Optimistic.ClusterWide.AcceptanceTests/ConfigureEndpointRavenDBPersistence.cs @@ -67,7 +67,7 @@ public static Task CreateDatabase(IDocumentStore defaultStore, string dbName, Ca { var dbRecord = new DatabaseRecord(dbName) { - Topology = new DatabaseTopology { Members = new List { "A", "B", "C" } } + Topology = new DatabaseTopology { Members = ["A", "B", "C"] } }; return defaultStore.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRecord, 3), cancellationToken); diff --git a/src/NServiceBus.RavenDB.PersistenceTests/PersistenceTestsConfiguration.cs b/src/NServiceBus.RavenDB.PersistenceTests/PersistenceTestsConfiguration.cs index 7015c5b37..ae210d99c 100644 --- a/src/NServiceBus.RavenDB.PersistenceTests/PersistenceTestsConfiguration.cs +++ b/src/NServiceBus.RavenDB.PersistenceTests/PersistenceTestsConfiguration.cs @@ -68,7 +68,7 @@ public async Task Configure(CancellationToken cancellationToken = default) GetContextBagForOutbox = GetContextBagForSagaStorage = () => { var context = new ContextBag(); - context.Set(new IncomingMessage("native id", new Dictionary(), Array.Empty())); + context.Set(new IncomingMessage("native id", [], Array.Empty())); return context; }; diff --git a/src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs b/src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs index 115154298..08b360c59 100644 --- a/src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs +++ b/src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs @@ -22,8 +22,8 @@ public void ApproveOutboxSchema() { MessageId = nameof(OutboxRecord.OutboxOperation.MessageId), Message = Array.Empty(), - Headers = new Dictionary(), - Options = new Dictionary(), + Headers = [], + Options = [], }, }, }); diff --git a/src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs b/src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs index f2a0c3b7e..53e2d005c 100644 --- a/src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs +++ b/src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs @@ -15,14 +15,14 @@ public void ApproveSubscriptionSchema() { Id = nameof(Subscription.Id), MessageType = new MessageType("System.Object", "4.0.0"), - Subscribers = new List - { + Subscribers = + [ new SubscriptionClient { Endpoint = nameof(SubscriptionClient.Endpoint), TransportAddress = nameof(SubscriptionClient.TransportAddress), }, - }, + ], }); } } diff --git a/src/NServiceBus.RavenDB.Tests/Infrastructure/StoreSnooper.cs b/src/NServiceBus.RavenDB.Tests/Infrastructure/StoreSnooper.cs index 1ef09108c..de953d649 100644 --- a/src/NServiceBus.RavenDB.Tests/Infrastructure/StoreSnooper.cs +++ b/src/NServiceBus.RavenDB.Tests/Infrastructure/StoreSnooper.cs @@ -26,6 +26,6 @@ public static StoreSnooper Install(DocumentStore store) return snooper; } - List keysStored = new List(); + List keysStored = []; } } diff --git a/src/NServiceBus.RavenDB.Tests/RavenDBPersistenceTestBase.cs b/src/NServiceBus.RavenDB.Tests/RavenDBPersistenceTestBase.cs index a6cfde52f..3a6e47c73 100644 --- a/src/NServiceBus.RavenDB.Tests/RavenDBPersistenceTestBase.cs +++ b/src/NServiceBus.RavenDB.Tests/RavenDBPersistenceTestBase.cs @@ -75,7 +75,7 @@ protected IncomingMessage SimulateIncomingMessage(ContextBag context, string mes { messageId ??= Guid.NewGuid().ToString("N"); - var incomingMessage = new IncomingMessage(messageId, new Dictionary(), new byte[0]); + var incomingMessage = new IncomingMessage(messageId, [], new byte[0]); context.Set(incomingMessage); diff --git a/src/NServiceBus.RavenDB/Internal/DocumentStoreInitializer.cs b/src/NServiceBus.RavenDB/Internal/DocumentStoreInitializer.cs index 8c3512b27..8918855cd 100644 --- a/src/NServiceBus.RavenDB/Internal/DocumentStoreInitializer.cs +++ b/src/NServiceBus.RavenDB/Internal/DocumentStoreInitializer.cs @@ -129,7 +129,7 @@ static void EnsureClusterConfiguration(IDocumentStore store, bool useClusterWide } } - List indexesToCreate = new List(); + List indexesToCreate = []; Func storeCreator; IDocumentStore docStore; bool isInitialized; diff --git a/src/NServiceBus.RavenDB/Subscriptions/Subscription.cs b/src/NServiceBus.RavenDB/Subscriptions/Subscription.cs index bd54f2b83..aca55ffe6 100644 --- a/src/NServiceBus.RavenDB/Subscriptions/Subscription.cs +++ b/src/NServiceBus.RavenDB/Subscriptions/Subscription.cs @@ -16,7 +16,7 @@ public List Subscribers { get { - subscribers ??= new List(); + subscribers ??= []; return subscribers; } diff --git a/src/NServiceBus.RavenDB/Subscriptions/SubscriptionPersister.cs b/src/NServiceBus.RavenDB/Subscriptions/SubscriptionPersister.cs index a0c73aeca..166100c44 100644 --- a/src/NServiceBus.RavenDB/Subscriptions/SubscriptionPersister.cs +++ b/src/NServiceBus.RavenDB/Subscriptions/SubscriptionPersister.cs @@ -53,7 +53,7 @@ public async Task Subscribe(Subscriber subscriber, MessageType messageType, Cont { Id = subscriptionDocId, MessageType = messageType, - Subscribers = new List() + Subscribers = [] }; await session.StoreAsync(subscription, cancellationToken).ConfigureAwait(false);