Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RC2 analyzer warnings #1215

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class OrderSagaData : ContainSagaData
{
public string OrderId { get; set; }
public int ContinueCount { get; set; }
public List<int> CollectedIndexes { get; set; } = new List<int>();
public List<int> CollectedIndexes { get; set; } = [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.RavenDB.AcceptanceTests/SagaAndOutbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class OrderSagaData : ContainSagaData
{
public string OrderId { get; set; }
public int ContinueCount { get; set; }
public List<int> CollectedIndexes { get; set; } = new List<int>();
public List<int> CollectedIndexes { get; set; } = [];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> ObservedDbs { get; } = new List<string>();
public List<string> ObservedDbs { get; } = [];
public string ObservedDbsOutput => string.Join(", ", ObservedDbs);
public ContextDbConfig DbConfig { get; } = new ContextDbConfig();
public int MessagesObserved;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static Task CreateDatabase(IDocumentStore defaultStore, string dbName, Ca
{
var dbRecord = new DatabaseRecord(dbName)
{
Topology = new DatabaseTopology { Members = new List<string> { "A", "B", "C" } }
Topology = new DatabaseTopology { Members = ["A", "B", "C"] }
};

return defaultStore.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRecord, 3), cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> { "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}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static Task CreateDatabase(IDocumentStore defaultStore, string dbName, Ca
{
var dbRecord = new DatabaseRecord(dbName)
{
Topology = new DatabaseTopology { Members = new List<string> { "A", "B", "C" } }
Topology = new DatabaseTopology { Members = ["A", "B", "C"] }
};

return defaultStore.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRecord, 3), cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>(), Array.Empty<byte>()));
context.Set(new IncomingMessage("native id", [], Array.Empty<byte>()));
return context;
};

Expand Down
4 changes: 2 additions & 2 deletions src/NServiceBus.RavenDB.Tests/API/OutboxApprovals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public void ApproveOutboxSchema()
{
MessageId = nameof(OutboxRecord.OutboxOperation.MessageId),
Message = Array.Empty<byte>(),
Headers = new Dictionary<string, string>(),
Options = new Dictionary<string, string>(),
Headers = [],
Options = [],
},
},
});
Expand Down
6 changes: 3 additions & 3 deletions src/NServiceBus.RavenDB.Tests/API/SubscriptionApprovals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void ApproveSubscriptionSchema()
{
Id = nameof(Subscription.Id),
MessageType = new MessageType("System.Object", "4.0.0"),
Subscribers = new List<SubscriptionClient>
{
Subscribers =
[
new SubscriptionClient
{
Endpoint = nameof(SubscriptionClient.Endpoint),
TransportAddress = nameof(SubscriptionClient.TransportAddress),
},
},
],
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public static StoreSnooper Install(DocumentStore store)
return snooper;
}

List<string> keysStored = new List<string>();
List<string> keysStored = [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected IncomingMessage SimulateIncomingMessage(ContextBag context, string mes
{
messageId ??= Guid.NewGuid().ToString("N");

var incomingMessage = new IncomingMessage(messageId, new Dictionary<string, string>(), new byte[0]);
var incomingMessage = new IncomingMessage(messageId, [], new byte[0]);

context.Set(incomingMessage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static void EnsureClusterConfiguration(IDocumentStore store, bool useClusterWide
}
}

List<AbstractIndexCreationTask> indexesToCreate = new List<AbstractIndexCreationTask>();
List<AbstractIndexCreationTask> indexesToCreate = [];
Func<IReadOnlySettings, IServiceProvider, IDocumentStore> storeCreator;
IDocumentStore docStore;
bool isInitialized;
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.RavenDB/Subscriptions/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public List<SubscriptionClient> Subscribers
{
get
{
subscribers ??= new List<SubscriptionClient>();
subscribers ??= [];

return subscribers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task Subscribe(Subscriber subscriber, MessageType messageType, Cont
{
Id = subscriptionDocId,
MessageType = messageType,
Subscribers = new List<SubscriptionClient>()
Subscribers = []
};

await session.StoreAsync(subscription, cancellationToken).ConfigureAwait(false);
Expand Down