diff --git a/Directory.Packages.props b/Directory.Packages.props index 9fcad1a8..4f2926d5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true - + diff --git a/samples/NetEvolve.Pulse.Xample.Aot/Program.cs b/samples/NetEvolve.Pulse.Xample.Aot/Program.cs index 7647cf8a..afcbe09b 100644 --- a/samples/NetEvolve.Pulse.Xample.Aot/Program.cs +++ b/samples/NetEvolve.Pulse.Xample.Aot/Program.cs @@ -23,75 +23,68 @@ void Check(bool condition, string description) // Scenario 1: AddPulse with the source-generated handler registrations, covering reference-type, // value-type and void responses, a query, a stream query, and closed as well as open-generic event handlers. -await RunAsync( - configure: null, - async (mediator, recorder) => - { - var order = await mediator - .SendAsync(new CreateOrderCommand("A-1")) - .ConfigureAwait(false); - Check(order == new OrderResult("A-1", Accepted: true), "command with reference-type response"); +await RunAsync(configure: null, async (mediator, recorder) => + { + var order = await mediator + .SendAsync(new CreateOrderCommand("A-1")) + .ConfigureAwait(false); + Check(order == new OrderResult("A-1", Accepted: true), "command with reference-type response"); - var sum = await mediator - .SendAsync(new AddNumbersCommand(2, 3)) - .ConfigureAwait(false); - Check(sum == 5, "command with value-type response"); + var sum = await mediator.SendAsync(new AddNumbersCommand(2, 3)).ConfigureAwait(false); + Check(sum == 5, "command with value-type response"); - await mediator.SendAsync(new PingCommand()).ConfigureAwait(false); - Check(recorder.Invocations.Contains(nameof(PingHandler)), "void command"); + await mediator.SendAsync(new PingCommand()).ConfigureAwait(false); + Check(recorder.Invocations.Contains(nameof(PingHandler)), "void command"); - var greeting = await mediator - .QueryAsync(new GreetingQuery("AOT")) - .ConfigureAwait(false); - Check(string.Equals(greeting, "Hello, AOT!", StringComparison.Ordinal), "query"); + var greeting = await mediator.QueryAsync(new GreetingQuery("AOT")).ConfigureAwait(false); + Check(string.Equals(greeting, "Hello, AOT!", StringComparison.Ordinal), "query"); - var countdown = await CollectAsync( - mediator.StreamQueryAsync(new CountdownStreamQuery(3)) - ) - .ConfigureAwait(false); - Check(string.Join(',', countdown) == "3,2,1", "stream query"); + var countdown = await CollectAsync( + mediator.StreamQueryAsync(new CountdownStreamQuery(3)) + ) + .ConfigureAwait(false); + Check(string.Join(',', countdown) == "3,2,1", "stream query"); - await mediator.PublishAsync(new OrderCreatedEvent("A-1")).ConfigureAwait(false); - Check(recorder.Invocations.Contains(nameof(OrderCreatedHandler)), "event handler"); - Check( - recorder.Invocations.Contains("OrderNotificationHandler"), - "second generated event handler for the same event" - ); - Check( - recorder.Invocations.Contains("AuditEventHandler"), - "open-generic event handler closed by the DI container" - ); + await mediator.PublishAsync(new OrderCreatedEvent("A-1")).ConfigureAwait(false); + Check(recorder.Invocations.Contains(nameof(OrderCreatedHandler)), "event handler"); + Check( + recorder.Invocations.Contains("OrderNotificationHandler"), + "second generated event handler for the same event" + ); + Check( + recorder.Invocations.Contains("AuditEventHandler"), + "open-generic event handler closed by the DI container" + ); - await mediator.PublishAsync(new OrderCancelledEvent("A-1")).ConfigureAwait(false); - Check( - recorder.Invocations.Contains("OrderNotificationHandler"), - "event handler implementing two event handler interfaces" - ); - var notificationInstances = recorder - .Invocations.Where(static i => i.StartsWith("OrderNotificationHandler#", StringComparison.Ordinal)) - .ToList(); - Check( - notificationInstances.Count == 2 && notificationInstances.Distinct(StringComparer.Ordinal).Count() == 1, - "event handler sharing one instance across two event handler interfaces" - ); + await mediator.PublishAsync(new OrderCancelledEvent("A-1")).ConfigureAwait(false); + Check( + recorder.Invocations.Contains("OrderNotificationHandler"), + "event handler implementing two event handler interfaces" + ); + var notificationInstances = recorder + .Invocations.Where(static i => i.StartsWith("OrderNotificationHandler#", StringComparison.Ordinal)) + .ToList(); + Check( + notificationInstances.Count == 2 && notificationInstances.Distinct(StringComparer.Ordinal).Count() == 1, + "event handler sharing one instance across two event handler interfaces" + ); - // The outbox providers persist ToOutboxEventTypeName() and rehydrate it with Type.GetType. Their IL2057 - // suppressions rely on this round-trip for event types that the application publishes. The event type is - // never named through typeof, and the persisted name is computed at runtime, so the compiler cannot root - // the type for the lookup. - var shipment = new ShipmentDispatchedEvent("S-1"); - await mediator.PublishAsync(shipment).ConfigureAwait(false); - Check( - recorder.Invocations.Contains("AuditEventHandler"), - "event without a closed handler" - ); - var persistedEventType = shipment.GetType().ToOutboxEventTypeName(); - Check( - ResolveOutboxEventType(persistedEventType) == shipment.GetType(), - "outbox event type name round-trip for a published event type" - ); - } - ) + // The outbox providers persist ToOutboxEventTypeName() and rehydrate it with Type.GetType. Their IL2057 + // suppressions rely on this round-trip for event types that the application publishes. The event type is + // never named through typeof, and the persisted name is computed at runtime, so the compiler cannot root + // the type for the lookup. + var shipment = new ShipmentDispatchedEvent("S-1"); + await mediator.PublishAsync(shipment).ConfigureAwait(false); + Check( + recorder.Invocations.Contains("AuditEventHandler"), + "event without a closed handler" + ); + var persistedEventType = shipment.GetType().ToOutboxEventTypeName(); + Check( + ResolveOutboxEventType(persistedEventType) == shipment.GetType(), + "outbox event type name round-trip for a published event type" + ); + }) .ConfigureAwait(false); // Scenario 2: open-generic interceptors (activity/metrics and logging, with options bound through the diff --git a/src/NetEvolve.Pulse.AspNetCore/Internals/XmlDocumentationReader.cs b/src/NetEvolve.Pulse.AspNetCore/Internals/XmlDocumentationReader.cs index 074477b9..3961b8d7 100644 --- a/src/NetEvolve.Pulse.AspNetCore/Internals/XmlDocumentationReader.cs +++ b/src/NetEvolve.Pulse.AspNetCore/Internals/XmlDocumentationReader.cs @@ -41,34 +41,31 @@ internal static bool TryGetSummary(Type type, out string? summary) { ArgumentNullException.ThrowIfNull(type); - summary = SummaryCache.GetOrAdd( - type, - static t => + summary = SummaryCache.GetOrAdd(type, static t => + { + var assemblyLocation = t.Assembly.Location; + if (string.IsNullOrEmpty(assemblyLocation)) + { + return null; + } + + var xmlPath = Path.ChangeExtension(assemblyLocation, ".xml"); + var members = LoadDocumentation(xmlPath); + if (members is null) + { + return null; + } + + // XML doc ids use '.' for nested types and the open generic definition (e.g. `1). + var fullName = (t.IsConstructedGenericType ? t.GetGenericTypeDefinition() : t).FullName; + if (fullName is null) { - var assemblyLocation = t.Assembly.Location; - if (string.IsNullOrEmpty(assemblyLocation)) - { - return null; - } - - var xmlPath = Path.ChangeExtension(assemblyLocation, ".xml"); - var members = LoadDocumentation(xmlPath); - if (members is null) - { - return null; - } - - // XML doc ids use '.' for nested types and the open generic definition (e.g. `1). - var fullName = (t.IsConstructedGenericType ? t.GetGenericTypeDefinition() : t).FullName; - if (fullName is null) - { - return null; - } - - var memberId = "T:" + fullName.Replace('+', '.'); - return members.TryGetValue(memberId, out var value) ? value : null; + return null; } - ); + + var memberId = "T:" + fullName.Replace('+', '.'); + return members.TryGetValue(memberId, out var value) ? value : null; + }); return summary is not null; } @@ -84,36 +81,33 @@ internal static bool TryGetSummary(Type type, out string? summary) /// when the file does not exist or contains no usable documentation. /// internal static IReadOnlyDictionary? LoadDocumentation(string xmlPath) => - DocumentationCache.GetOrAdd( - xmlPath, - static path => + DocumentationCache.GetOrAdd(xmlPath, static path => + { + if (!File.Exists(path)) + { + return null; + } + + try + { + var document = XDocument.Load(path); + var members = document + .Descendants("member") + .Select(member => new + { + Name = (string?)member.Attribute("name"), + Summary = member.Element("summary") is { } summary ? RenderText(summary) : null, + }) + .Where(entry => entry.Name is not null && entry.Summary is not null) + .ToDictionary(entry => entry.Name!, entry => entry.Summary!, StringComparer.Ordinal); + + return members.Count > 0 ? members : null; + } + catch (Exception ex) when (ex is IOException or System.Xml.XmlException or UnauthorizedAccessException) { - if (!File.Exists(path)) - { - return null; - } - - try - { - var document = XDocument.Load(path); - var members = document - .Descendants("member") - .Select(member => new - { - Name = (string?)member.Attribute("name"), - Summary = member.Element("summary") is { } summary ? RenderText(summary) : null, - }) - .Where(entry => entry.Name is not null && entry.Summary is not null) - .ToDictionary(entry => entry.Name!, entry => entry.Summary!, StringComparer.Ordinal); - - return members.Count > 0 ? members : null; - } - catch (Exception ex) when (ex is IOException or System.Xml.XmlException or UnauthorizedAccessException) - { - return null; - } + return null; } - ); + }); /// /// Renders the text of a documentation element as a single line, replacing inline reference diff --git a/src/NetEvolve.Pulse.EntityFramework/Configurations/TypeValueConverter.cs b/src/NetEvolve.Pulse.EntityFramework/Configurations/TypeValueConverter.cs index 44ab8337..01dba747 100644 --- a/src/NetEvolve.Pulse.EntityFramework/Configurations/TypeValueConverter.cs +++ b/src/NetEvolve.Pulse.EntityFramework/Configurations/TypeValueConverter.cs @@ -24,8 +24,7 @@ public TypeValueConverter() private static string ConvertToString(Type type) { - var name = - type.AssemblyQualifiedName + var name = type.AssemblyQualifiedName ?? throw new InvalidOperationException($"Cannot get assembly-qualified name for type: {type}"); if (name.Length > OutboxMessageSchema.MaxLengths.EventType) diff --git a/src/NetEvolve.Pulse.Extensibility/DeadLetter/CommandDeadLetterReplayDispatcher.cs b/src/NetEvolve.Pulse.Extensibility/DeadLetter/CommandDeadLetterReplayDispatcher.cs index cbc8a9b4..138a58f6 100644 --- a/src/NetEvolve.Pulse.Extensibility/DeadLetter/CommandDeadLetterReplayDispatcher.cs +++ b/src/NetEvolve.Pulse.Extensibility/DeadLetter/CommandDeadLetterReplayDispatcher.cs @@ -122,8 +122,7 @@ private static Type ResolveCommandType(string commandType) return cached; } - var resolved = - Type.GetType(commandType, throwOnError: false) + var resolved = Type.GetType(commandType, throwOnError: false) ?? throw new InvalidOperationException($"Cannot resolve command type '{commandType}'."); return CommandTypeCache.GetOrAdd(commandType, resolved); diff --git a/src/NetEvolve.Pulse.Kafka/Outbox/KafkaMessageTransport.cs b/src/NetEvolve.Pulse.Kafka/Outbox/KafkaMessageTransport.cs index 22f13e30..059c3aeb 100644 --- a/src/NetEvolve.Pulse.Kafka/Outbox/KafkaMessageTransport.cs +++ b/src/NetEvolve.Pulse.Kafka/Outbox/KafkaMessageTransport.cs @@ -121,17 +121,13 @@ public async Task SendBatchAsync(IEnumerable messages, Cancellati try { - _producer.Produce( - topic, - kafkaMessage, - report => + _producer.Produce(topic, kafkaMessage, report => + { + if (report.Error.IsError) { - if (report.Error.IsError) - { - errors.Add(new ProduceException(report.Error, report)); - } + errors.Add(new ProduceException(report.Error, report)); } - ); + }); } catch (ProduceException ex) { diff --git a/src/NetEvolve.Pulse.MySql/DeadLetter/MySqlCommandDeadLetterManagement.cs b/src/NetEvolve.Pulse.MySql/DeadLetter/MySqlCommandDeadLetterManagement.cs index 20ebb446..5cd94808 100644 --- a/src/NetEvolve.Pulse.MySql/DeadLetter/MySqlCommandDeadLetterManagement.cs +++ b/src/NetEvolve.Pulse.MySql/DeadLetter/MySqlCommandDeadLetterManagement.cs @@ -188,8 +188,7 @@ public async Task ReplayAsync(Guid id, CancellationToken cancellationToken = def { cancellationToken.ThrowIfCancellationRequested(); - var entry = - await GetByIdAsync(id, cancellationToken).ConfigureAwait(false) + var entry = await GetByIdAsync(id, cancellationToken).ConfigureAwait(false) ?? throw new CommandDeadLetterEntryNotFoundException(id); if (entry.Status == CommandDeadLetterStatus.Dismissed) diff --git a/src/NetEvolve.Pulse.MySql/Outbox/MySqlOutboxRepository.cs b/src/NetEvolve.Pulse.MySql/Outbox/MySqlOutboxRepository.cs index 6dd32354..43400b33 100644 --- a/src/NetEvolve.Pulse.MySql/Outbox/MySqlOutboxRepository.cs +++ b/src/NetEvolve.Pulse.MySql/Outbox/MySqlOutboxRepository.cs @@ -245,8 +245,7 @@ public async Task AddAsync(OutboxMessage message, CancellationToken cancellation if (transaction is not null) { // Use the connection from the ambient transaction to avoid mismatch - var connection = - transaction.Connection + var connection = transaction.Connection ?? throw new InvalidOperationException("Transaction has no associated connection."); var command = new MySqlCommand(_insertSql, connection, transaction); diff --git a/src/NetEvolve.Pulse.Polly/Interceptors/PollyEventInterceptor{TEvent}.cs b/src/NetEvolve.Pulse.Polly/Interceptors/PollyEventInterceptor{TEvent}.cs index 16e50268..43bb0bea 100644 --- a/src/NetEvolve.Pulse.Polly/Interceptors/PollyEventInterceptor{TEvent}.cs +++ b/src/NetEvolve.Pulse.Polly/Interceptors/PollyEventInterceptor{TEvent}.cs @@ -85,8 +85,7 @@ public PollyEventInterceptor(IServiceProvider serviceProvider) ArgumentNullException.ThrowIfNull(serviceProvider); // Try to resolve keyed pipeline first (per-event), then fallback to global - _pipeline = - serviceProvider.GetKeyedService(typeof(TEvent)) + _pipeline = serviceProvider.GetKeyedService(typeof(TEvent)) ?? serviceProvider.GetService() ?? throw new InvalidOperationException( $"No ResiliencePipeline registered for {typeof(TEvent).Name} or globally." diff --git a/src/NetEvolve.Pulse.Polly/Interceptors/PollyRequestInterceptor{TRequest,TResponse}.cs b/src/NetEvolve.Pulse.Polly/Interceptors/PollyRequestInterceptor{TRequest,TResponse}.cs index 259b622d..58318a1e 100644 --- a/src/NetEvolve.Pulse.Polly/Interceptors/PollyRequestInterceptor{TRequest,TResponse}.cs +++ b/src/NetEvolve.Pulse.Polly/Interceptors/PollyRequestInterceptor{TRequest,TResponse}.cs @@ -86,8 +86,7 @@ public PollyRequestInterceptor(IServiceProvider serviceProvider) ArgumentNullException.ThrowIfNull(serviceProvider); // Try to resolve keyed pipeline first (per-request), then fallback to global - _pipeline = - serviceProvider.GetKeyedService>(typeof(TRequest)) + _pipeline = serviceProvider.GetKeyedService>(typeof(TRequest)) ?? serviceProvider.GetService>() ?? throw new InvalidOperationException( $"No ResiliencePipeline<{typeof(TResponse).Name}> registered for {typeof(TRequest).Name} or globally." diff --git a/src/NetEvolve.Pulse.Polly/Interceptors/PollyStreamQueryInterceptor{TQuery,TResponse}.cs b/src/NetEvolve.Pulse.Polly/Interceptors/PollyStreamQueryInterceptor{TQuery,TResponse}.cs index 22f4db93..6cbf6b45 100644 --- a/src/NetEvolve.Pulse.Polly/Interceptors/PollyStreamQueryInterceptor{TQuery,TResponse}.cs +++ b/src/NetEvolve.Pulse.Polly/Interceptors/PollyStreamQueryInterceptor{TQuery,TResponse}.cs @@ -72,8 +72,7 @@ public PollyStreamQueryInterceptor(IServiceProvider serviceProvider) // Try to resolve keyed pipeline first (per-query), then fallback to global // If neither is registered, _pipeline remains null and the interceptor passes through - _pipeline = - serviceProvider.GetKeyedService(typeof(TQuery)) + _pipeline = serviceProvider.GetKeyedService(typeof(TQuery)) ?? serviceProvider.GetService(); } diff --git a/src/NetEvolve.Pulse.PostgreSql/DeadLetter/PostgreSqlCommandDeadLetterManagement.cs b/src/NetEvolve.Pulse.PostgreSql/DeadLetter/PostgreSqlCommandDeadLetterManagement.cs index 996c7a2c..f6f20493 100644 --- a/src/NetEvolve.Pulse.PostgreSql/DeadLetter/PostgreSqlCommandDeadLetterManagement.cs +++ b/src/NetEvolve.Pulse.PostgreSql/DeadLetter/PostgreSqlCommandDeadLetterManagement.cs @@ -202,8 +202,7 @@ public async Task ReplayAsync(Guid id, CancellationToken cancellationToken = def var connection = await CreateConnectionAsync(cancellationToken).ConfigureAwait(false); await using (connection.ConfigureAwait(false)) { - var entry = - await GetByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) + var entry = await GetByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) ?? throw new CommandDeadLetterEntryNotFoundException(id); if (entry.Status == CommandDeadLetterStatus.Dismissed) diff --git a/src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlOutboxRepository.cs b/src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlOutboxRepository.cs index 19b89acf..09fb6b04 100644 --- a/src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlOutboxRepository.cs +++ b/src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlOutboxRepository.cs @@ -171,8 +171,7 @@ public async Task AddAsync(OutboxMessage message, CancellationToken cancellation if (transaction is not null) { // Use the connection from the ambient transaction to avoid mismatch - var connection = - transaction.Connection + var connection = transaction.Connection ?? throw new InvalidOperationException("Transaction has no associated connection."); var command = new NpgsqlCommand(_insertSql, connection, transaction); diff --git a/src/NetEvolve.Pulse.SQLite/DeadLetter/SQLiteCommandDeadLetterManagement.cs b/src/NetEvolve.Pulse.SQLite/DeadLetter/SQLiteCommandDeadLetterManagement.cs index 2b548abd..b8bf9f59 100644 --- a/src/NetEvolve.Pulse.SQLite/DeadLetter/SQLiteCommandDeadLetterManagement.cs +++ b/src/NetEvolve.Pulse.SQLite/DeadLetter/SQLiteCommandDeadLetterManagement.cs @@ -209,8 +209,7 @@ public async Task ReplayAsync(Guid id, CancellationToken cancellationToken = def var connection = await CreateConnectionAsync(cancellationToken).ConfigureAwait(false); await using (connection.ConfigureAwait(false)) { - var entry = - await GetByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) + var entry = await GetByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) ?? throw new CommandDeadLetterEntryNotFoundException(id); if (entry.Status == CommandDeadLetterStatus.Dismissed) diff --git a/src/NetEvolve.Pulse.SQLite/Outbox/SQLiteOutboxRepository.cs b/src/NetEvolve.Pulse.SQLite/Outbox/SQLiteOutboxRepository.cs index 42c0f472..215d676c 100644 --- a/src/NetEvolve.Pulse.SQLite/Outbox/SQLiteOutboxRepository.cs +++ b/src/NetEvolve.Pulse.SQLite/Outbox/SQLiteOutboxRepository.cs @@ -283,8 +283,7 @@ public async Task AddAsync(OutboxMessage message, CancellationToken cancellation if (transaction is not null) { - var connection = - transaction.Connection + var connection = transaction.Connection ?? throw new InvalidOperationException("Transaction has no associated connection."); var command = new SqliteCommand(_insertSql, connection, transaction); diff --git a/src/NetEvolve.Pulse.SourceGeneration/Generators/PulseHandlerGenerator.cs b/src/NetEvolve.Pulse.SourceGeneration/Generators/PulseHandlerGenerator.cs index 0bb216e0..4589a775 100644 --- a/src/NetEvolve.Pulse.SourceGeneration/Generators/PulseHandlerGenerator.cs +++ b/src/NetEvolve.Pulse.SourceGeneration/Generators/PulseHandlerGenerator.cs @@ -76,9 +76,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context) .Combine(assemblyName) .Combine(nativeAotInterceptorsAvailable); - context.RegisterSourceOutput( - combined, - static (spc, data) => Execute(spc, data.Left.Left.Left, data.Left.Left.Right, data.Left.Right, data.Right) + context.RegisterSourceOutput(combined, static (spc, data) => + Execute(spc, data.Left.Left.Left, data.Left.Left.Right, data.Left.Right, data.Right) ); RegisterBlockedHandlerDiagnosticPipeline(context, pulseHandlerResults); @@ -147,16 +146,14 @@ private static void RegisterBlockedHandlerDiagnosticPipeline( { var blockedHandlers = handlerResults.Where(static result => result.Info.HasValue && result.Blocker is not null); - context.RegisterSourceOutput( - blockedHandlers, - static (spc, result) => - spc.ReportDiagnostic( - Diagnostic.Create( - result.Blocker!, - result.Info!.Value.Location.ToLocation(), - result.Info.Value.HandlerTypeName - ) + context.RegisterSourceOutput(blockedHandlers, static (spc, result) => + spc.ReportDiagnostic( + Diagnostic.Create( + result.Blocker!, + result.Info!.Value.Location.ToLocation(), + result.Info.Value.HandlerTypeName ) + ) ); } @@ -178,16 +175,14 @@ private static void RegisterUnannotatedHandlerDiagnosticPipeline(IncrementalGene .Where(static info => info.HasValue) .Select(static (info, _) => info!.Value); - context.RegisterSourceOutput( - unannotatedHandlers, - static (spc, info) => - spc.ReportDiagnostic( - Diagnostic.Create( - DiagnosticDescriptors.MissingPulseHandlerAttribute, - info.Location.ToLocation(), - info.HandlerTypeName - ) + context.RegisterSourceOutput(unannotatedHandlers, static (spc, info) => + spc.ReportDiagnostic( + Diagnostic.Create( + DiagnosticDescriptors.MissingPulseHandlerAttribute, + info.Location.ToLocation(), + info.HandlerTypeName ) + ) ); } @@ -204,19 +199,17 @@ IncrementalValuesProvider explicitHandlerResults { var errors = explicitHandlerResults.SelectMany(static (result, _) => result.Errors); - context.RegisterSourceOutput( - errors, - static (spc, error) => - spc.ReportDiagnostic( - Diagnostic.Create( - error.IsPulse005 - ? DiagnosticDescriptors.InvalidExplicitMessageType - : DiagnosticDescriptors.IncompatibleExplicitMessageType, - error.Location.ToLocation(), - error.MessageTypeName, - error.HandlerTypeName - ) + context.RegisterSourceOutput(errors, static (spc, error) => + spc.ReportDiagnostic( + Diagnostic.Create( + error.IsPulse005 + ? DiagnosticDescriptors.InvalidExplicitMessageType + : DiagnosticDescriptors.IncompatibleExplicitMessageType, + error.Location.ToLocation(), + error.MessageTypeName, + error.HandlerTypeName ) + ) ); } @@ -242,8 +235,7 @@ CancellationToken ct // A generic handler is closed over the attribute's message type, so that type must be // referenceable as well. - var blocker = - GetRegistrationBlocker(classSymbol) + var blocker = GetRegistrationBlocker(classSymbol) ?? ( ctx.Attributes.Any(attr => attr.AttributeClass?.TypeArguments.Length == 1 diff --git a/src/NetEvolve.Pulse.SqlServer/DeadLetter/SqlServerCommandDeadLetterManagement.cs b/src/NetEvolve.Pulse.SqlServer/DeadLetter/SqlServerCommandDeadLetterManagement.cs index d4ea297a..2f76cc3e 100644 --- a/src/NetEvolve.Pulse.SqlServer/DeadLetter/SqlServerCommandDeadLetterManagement.cs +++ b/src/NetEvolve.Pulse.SqlServer/DeadLetter/SqlServerCommandDeadLetterManagement.cs @@ -205,8 +205,7 @@ public async Task ReplayAsync(Guid id, CancellationToken cancellationToken = def var connection = await CreateConnectionAsync(cancellationToken).ConfigureAwait(false); await using (connection.ConfigureAwait(false)) { - var entry = - await GetEntryByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) + var entry = await GetEntryByIdAsync(connection, id, cancellationToken).ConfigureAwait(false) ?? throw new CommandDeadLetterEntryNotFoundException(id); if (entry.Status == CommandDeadLetterStatus.Dismissed) diff --git a/src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerOutboxRepository.cs b/src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerOutboxRepository.cs index 2ff5a142..b8c75415 100644 --- a/src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerOutboxRepository.cs +++ b/src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerOutboxRepository.cs @@ -145,8 +145,7 @@ public async Task AddAsync(OutboxMessage message, CancellationToken cancellation if (transaction is not null) { // Use the connection from the ambient transaction to avoid mismatch - var connection = - transaction.Connection + var connection = transaction.Connection ?? throw new InvalidOperationException("Transaction has no associated connection."); var command = new SqlCommand(_insertSql, connection, transaction); diff --git a/src/NetEvolve.Pulse/Dispatchers/ParallelEventDispatcher.cs b/src/NetEvolve.Pulse/Dispatchers/ParallelEventDispatcher.cs index 80731ffc..883e90e1 100644 --- a/src/NetEvolve.Pulse/Dispatchers/ParallelEventDispatcher.cs +++ b/src/NetEvolve.Pulse/Dispatchers/ParallelEventDispatcher.cs @@ -88,21 +88,17 @@ CancellationToken cancellationToken var exceptions = new ConcurrentBag(); await Parallel - .ForEachAsync( - handlers, - cancellationToken, - async (handler, token) => + .ForEachAsync(handlers, cancellationToken, async (handler, token) => + { + try + { + await invoker(handler, message, token).ConfigureAwait(false); + } + catch (Exception ex) when (!token.IsCancellationRequested) { - try - { - await invoker(handler, message, token).ConfigureAwait(false); - } - catch (Exception ex) when (!token.IsCancellationRequested) - { - exceptions.Add(ex); - } + exceptions.Add(ex); } - ) + }) .ConfigureAwait(false); if (!exceptions.IsEmpty) diff --git a/src/NetEvolve.Pulse/Dispatchers/RateLimitedEventDispatcher.cs b/src/NetEvolve.Pulse/Dispatchers/RateLimitedEventDispatcher.cs index 693540d9..7ea673a2 100644 --- a/src/NetEvolve.Pulse/Dispatchers/RateLimitedEventDispatcher.cs +++ b/src/NetEvolve.Pulse/Dispatchers/RateLimitedEventDispatcher.cs @@ -128,21 +128,17 @@ CancellationToken cancellationToken }; await Parallel - .ForEachAsync( - handlers, - options, - async (handler, token) => + .ForEachAsync(handlers, options, async (handler, token) => + { + try + { + await invoker(handler, message, token).ConfigureAwait(false); + } + catch (Exception ex) when (!token.IsCancellationRequested) { - try - { - await invoker(handler, message, token).ConfigureAwait(false); - } - catch (Exception ex) when (!token.IsCancellationRequested) - { - exceptions.Add(ex); - } + exceptions.Add(ex); } - ) + }) .ConfigureAwait(false); if (!exceptions.IsEmpty) diff --git a/src/NetEvolve.Pulse/Internals/TelemetryUnits.cs b/src/NetEvolve.Pulse/Internals/TelemetryUnits.cs index 831384e6..5b494945 100644 --- a/src/NetEvolve.Pulse/Internals/TelemetryUnits.cs +++ b/src/NetEvolve.Pulse/Internals/TelemetryUnits.cs @@ -53,11 +53,8 @@ public static Counter GetSharedCounter( string description, bool useSemanticConventionUnits ) => - GetShared( - name, - useSemanticConventionUnits, - () => - CreateCounter(Defaults.Meter, name, legacyUnit, annotationUnit, description, useSemanticConventionUnits) + GetShared(name, useSemanticConventionUnits, () => + CreateCounter(Defaults.Meter, name, legacyUnit, annotationUnit, description, useSemanticConventionUnits) ); /// @@ -72,10 +69,8 @@ public static Histogram GetSharedDurationHistogram( string subject, bool useSemanticConventionUnits ) => - GetShared( - name, - useSemanticConventionUnits, - () => CreateDurationHistogram(Defaults.Meter, name, subject, useSemanticConventionUnits) + GetShared(name, useSemanticConventionUnits, () => + CreateDurationHistogram(Defaults.Meter, name, subject, useSemanticConventionUnits) ); /// diff --git a/src/NetEvolve.Pulse/Outbox/OutboxProcessorHostedService.cs b/src/NetEvolve.Pulse/Outbox/OutboxProcessorHostedService.cs index 6c2d05e6..2f890119 100644 --- a/src/NetEvolve.Pulse/Outbox/OutboxProcessorHostedService.cs +++ b/src/NetEvolve.Pulse/Outbox/OutboxProcessorHostedService.cs @@ -354,29 +354,24 @@ private async Task ProcessBatchAsync(IOutboxRepository repository, Cancella var messagesByEventType = messages.GroupBy(m => m.EventType).ToDictionary(m => m.Key, m => m.ToArray()); await Parallel - .ForEachAsync( - messagesByEventType, - cancellationToken, - async (messageGroup, token) => + .ForEachAsync(messagesByEventType, cancellationToken, async (messageGroup, token) => + { + if (token.IsCancellationRequested) { - if (token.IsCancellationRequested) - { - return; - } - - // Resolve a dedicated scope (and repository instance) per parallel work item so - // concurrent branches never share a single scoped repository/DbContext instance. - using var workItemScope = _scopeFactory.CreateScope(); - var workItemRepository = workItemScope.ServiceProvider.GetRequiredService(); - - var succeeded = _options.GetEffectiveEnableBatchSending(messageGroup.Key) - ? await ProcessBatchSendAsync(workItemRepository, messageGroup.Value, token) - .ConfigureAwait(false) - : await ProcessIndividuallyAsync(workItemRepository, messageGroup.Value, token) - .ConfigureAwait(false); - _ = Interlocked.Add(ref succeededCount, succeeded); + return; } - ) + + // Resolve a dedicated scope (and repository instance) per parallel work item so + // concurrent branches never share a single scoped repository/DbContext instance. + using var workItemScope = _scopeFactory.CreateScope(); + var workItemRepository = workItemScope.ServiceProvider.GetRequiredService(); + + var succeeded = _options.GetEffectiveEnableBatchSending(messageGroup.Key) + ? await ProcessBatchSendAsync(workItemRepository, messageGroup.Value, token).ConfigureAwait(false) + : await ProcessIndividuallyAsync(workItemRepository, messageGroup.Value, token) + .ConfigureAwait(false); + _ = Interlocked.Add(ref succeededCount, succeeded); + }) .ConfigureAwait(false); // Refresh the pending count gauge after processing so the observed value reflects the @@ -612,18 +607,10 @@ CancellationToken cancellationToken // not retried before one polling interval (or its backoff delay) has passed. var now = _timeProvider.GetUtcNow(); await Parallel - .ForEachAsync( - failedMessages, - cancellationToken, - async (message, token) => - await repository - .MarkAsFailedAsync( - message.Id, - ex.Message, - ComputeNextRetryAt(now, message.RetryCount), - token - ) - .ConfigureAwait(false) + .ForEachAsync(failedMessages, cancellationToken, async (message, token) => + await repository + .MarkAsFailedAsync(message.Id, ex.Message, ComputeNextRetryAt(now, message.RetryCount), token) + .ConfigureAwait(false) ) .ConfigureAwait(false); diff --git a/tests/NetEvolve.Pulse.Tests.Integration/AspNetCore/PulseStreamHubIntegrationTests.cs b/tests/NetEvolve.Pulse.Tests.Integration/AspNetCore/PulseStreamHubIntegrationTests.cs index 021cbc0a..9a6da72b 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/AspNetCore/PulseStreamHubIntegrationTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/AspNetCore/PulseStreamHubIntegrationTests.cs @@ -117,9 +117,8 @@ private static async Task ConnectAsync(IHost host, CancellationTo var server = host.GetTestServer(); var connection = new HubConnectionBuilder() - .WithUrl( - new Uri(server.BaseAddress, HubPath), - options => options.HttpMessageHandlerFactory = _ => server.CreateHandler() + .WithUrl(new Uri(server.BaseAddress, HubPath), options => + options.HttpMessageHandlerFactory = _ => server.CreateHandler() ) .Build(); diff --git a/tests/NetEvolve.Pulse.Tests.Integration/AzureQueueStorage/AzureQueueStorageMessageTransportIntegrationTests.cs b/tests/NetEvolve.Pulse.Tests.Integration/AzureQueueStorage/AzureQueueStorageMessageTransportIntegrationTests.cs index fb4f6454..33a62151 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/AzureQueueStorage/AzureQueueStorageMessageTransportIntegrationTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/AzureQueueStorage/AzureQueueStorageMessageTransportIntegrationTests.cs @@ -316,9 +316,8 @@ CancellationToken cancellationToken var services = new ServiceCollection(); _ = services.AddPulse(config => - config.UseAzureQueueStorageTransport( - new Uri("https://example.queue.core.windows.net"), - o => o.QueueName = CreateUniqueQueueName() + config.UseAzureQueueStorageTransport(new Uri("https://example.queue.core.windows.net"), o => + o.QueueName = CreateUniqueQueueName() ) ); diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/EntityFrameworkAuditInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/EntityFrameworkAuditInitializer.cs index dce9cdfd..decec044 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/EntityFrameworkAuditInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/EntityFrameworkAuditInitializer.cs @@ -89,9 +89,8 @@ public void Initialize(IServiceCollection services, IServiceFixture serviceFixtu ServiceType.SQLite => options .UseSqlite(connectionString) .AddInterceptors(new SQLiteBusyTimeoutInterceptor()), - ServiceType.SqlServer => options.UseSqlServer( - connectionString, - sqlOptions => sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) + ServiceType.SqlServer => options.UseSqlServer(connectionString, sqlOptions => + sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) ), _ => throw new NotSupportedException($"Database type {serviceFixture.ServiceType} is not supported."), }; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/MySqlAdoNetAuditInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/MySqlAdoNetAuditInitializer.cs index 5707e6e8..11300766 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/MySqlAdoNetAuditInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/MySqlAdoNetAuditInitializer.cs @@ -26,8 +26,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("AuditStoreOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/PostgreSqlAdoNetAuditInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/PostgreSqlAdoNetAuditInitializer.cs index c24dad3f..13530e46 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/PostgreSqlAdoNetAuditInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/PostgreSqlAdoNetAuditInitializer.cs @@ -32,8 +32,8 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can ? AuditEntrySchema.DefaultTableName : options.TableName; - var fixture = - _serviceFixture ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); + var fixture = _serviceFixture + ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); await fixture .Container.RunScriptAsync("AuditEntry.sql", fixture.DatabaseName, schema, tableName, cancellationToken) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SQLiteAdoNetAuditInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SQLiteAdoNetAuditInitializer.cs index fc5908de..ce61696b 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SQLiteAdoNetAuditInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SQLiteAdoNetAuditInitializer.cs @@ -30,8 +30,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("AuditStoreOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SqlServerAdoNetAuditInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SqlServerAdoNetAuditInitializer.cs index 676e549a..5b364605 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SqlServerAdoNetAuditInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Audit/SqlServerAdoNetAuditInitializer.cs @@ -37,8 +37,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("AuditStoreOptions.ConnectionString is not configured."); var schema = string.IsNullOrWhiteSpace(options.Schema) ? AuditEntrySchema.DefaultSchema : options.Schema; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/EntityFrameworkCommandDeadLetterInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/EntityFrameworkCommandDeadLetterInitializer.cs index e8e638e5..03d116bd 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/EntityFrameworkCommandDeadLetterInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/EntityFrameworkCommandDeadLetterInitializer.cs @@ -88,9 +88,8 @@ public void Initialize(IServiceCollection services, IServiceFixture serviceFixtu ServiceType.SQLite => options .UseSqlite(connectionString) .AddInterceptors(new SQLiteBusyTimeoutInterceptor()), - ServiceType.SqlServer => options.UseSqlServer( - connectionString, - sqlOptions => sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) + ServiceType.SqlServer => options.UseSqlServer(connectionString, sqlOptions => + sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) ), _ => throw new NotSupportedException($"Database type {serviceFixture.ServiceType} is not supported."), }; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/MySqlAdoNetCommandDeadLetterInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/MySqlAdoNetCommandDeadLetterInitializer.cs index 5e6bc657..8838483c 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/MySqlAdoNetCommandDeadLetterInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/MySqlAdoNetCommandDeadLetterInitializer.cs @@ -28,8 +28,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("CommandDeadLetterOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/PostgreSqlAdoNetCommandDeadLetterInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/PostgreSqlAdoNetCommandDeadLetterInitializer.cs index 806a381e..0921a818 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/PostgreSqlAdoNetCommandDeadLetterInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/PostgreSqlAdoNetCommandDeadLetterInitializer.cs @@ -33,8 +33,8 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can ? CommandDeadLetterSchema.DefaultTableName : options.TableName; - var fixture = - _serviceFixture ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); + var fixture = _serviceFixture + ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); await fixture .Container.RunScriptAsync( diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SQLiteAdoNetCommandDeadLetterInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SQLiteAdoNetCommandDeadLetterInitializer.cs index e77c1a89..ce252032 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SQLiteAdoNetCommandDeadLetterInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SQLiteAdoNetCommandDeadLetterInitializer.cs @@ -32,8 +32,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("CommandDeadLetterOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SqlServerAdoNetCommandDeadLetterInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SqlServerAdoNetCommandDeadLetterInitializer.cs index d52c37fb..3200b1e3 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SqlServerAdoNetCommandDeadLetterInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/DeadLetter/SqlServerAdoNetCommandDeadLetterInitializer.cs @@ -38,8 +38,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("CommandDeadLetterOptions.ConnectionString is not configured."); var schema = string.IsNullOrWhiteSpace(options.Schema) ? CommandDeadLetterSchema.DefaultSchema : options.Schema; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/EntityFrameworkIdempotencyInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/EntityFrameworkIdempotencyInitializer.cs index 62996885..585502c3 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/EntityFrameworkIdempotencyInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/EntityFrameworkIdempotencyInitializer.cs @@ -88,9 +88,8 @@ public void Initialize(IServiceCollection services, IServiceFixture serviceFixtu ServiceType.SQLite => options .UseSqlite(connectionString) .AddInterceptors(new SQLiteBusyTimeoutInterceptor()), - ServiceType.SqlServer => options.UseSqlServer( - connectionString, - sqlOptions => sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) + ServiceType.SqlServer => options.UseSqlServer(connectionString, sqlOptions => + sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) ), _ => throw new NotSupportedException($"Database type {serviceFixture.ServiceType} is not supported."), }; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/MySqlAdoNetIdempotencyInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/MySqlAdoNetIdempotencyInitializer.cs index 9a51ec8e..005142d3 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/MySqlAdoNetIdempotencyInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/MySqlAdoNetIdempotencyInitializer.cs @@ -26,8 +26,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("IdempotencyKeyOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/PostgreSqlAdoNetIdempotencyInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/PostgreSqlAdoNetIdempotencyInitializer.cs index e7bb7bc6..8261bdde 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/PostgreSqlAdoNetIdempotencyInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/PostgreSqlAdoNetIdempotencyInitializer.cs @@ -31,8 +31,8 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can ? IdempotencyKeySchema.DefaultTableName : options.TableName; - var fixture = - _serviceFixture ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); + var fixture = _serviceFixture + ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); await fixture .Container.RunScriptAsync("IdempotencyKey.sql", fixture.DatabaseName, schema, tableName, cancellationToken) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SQLiteAdoNetIdempotencyInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SQLiteAdoNetIdempotencyInitializer.cs index c43fb7ee..4f24bce6 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SQLiteAdoNetIdempotencyInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SQLiteAdoNetIdempotencyInitializer.cs @@ -30,8 +30,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("IdempotencyKeyOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SqlServerAdoNetIdempotencyInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SqlServerAdoNetIdempotencyInitializer.cs index 27866db1..a67e6899 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SqlServerAdoNetIdempotencyInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Idempotency/SqlServerAdoNetIdempotencyInitializer.cs @@ -35,8 +35,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("IdempotencyKeyOptions.ConnectionString is not configured."); var schema = string.IsNullOrWhiteSpace(options.Schema) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/EntityFrameworkOutboxInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/EntityFrameworkOutboxInitializer.cs index 88e00115..72c2e4d1 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/EntityFrameworkOutboxInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/EntityFrameworkOutboxInitializer.cs @@ -95,9 +95,8 @@ public void Initialize(IServiceCollection services, IServiceFixture serviceFixtu ServiceType.SQLite => options .UseSqlite(connectionString) .AddInterceptors(new SQLiteBusyTimeoutInterceptor()), - ServiceType.SqlServer => options.UseSqlServer( - connectionString, - sqlOptions => sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) + ServiceType.SqlServer => options.UseSqlServer(connectionString, sqlOptions => + sqlOptions.EnableRetryOnFailure(maxRetryCount: 5) ), _ => throw new NotSupportedException($"Database type {serviceFixture.ServiceType} is not supported."), }; diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/MySqlAdoNetOutboxInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/MySqlAdoNetOutboxInitializer.cs index 95751756..ba3482bd 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/MySqlAdoNetOutboxInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/MySqlAdoNetOutboxInitializer.cs @@ -26,8 +26,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("OutboxOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/PostgreSqlAdoNetOutboxInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/PostgreSqlAdoNetOutboxInitializer.cs index b5618323..59bd1577 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/PostgreSqlAdoNetOutboxInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/PostgreSqlAdoNetOutboxInitializer.cs @@ -31,8 +31,8 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can ? OutboxMessageSchema.DefaultTableName : options.TableName; - var fixture = - _serviceFixture ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); + var fixture = _serviceFixture + ?? throw new InvalidOperationException("Configure must run before CreateDatabaseAsync."); await fixture .Container.RunScriptAsync("OutboxMessage.sql", fixture.DatabaseName, schema, tableName, cancellationToken) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SQLiteAdoNetOutboxInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SQLiteAdoNetOutboxInitializer.cs index 4586a3eb..94a533e7 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SQLiteAdoNetOutboxInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SQLiteAdoNetOutboxInitializer.cs @@ -30,8 +30,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("OutboxOptions.ConnectionString is not configured."); var tableName = string.IsNullOrWhiteSpace(options.TableName) diff --git a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SqlServerAdoNetOutboxInitializer.cs b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SqlServerAdoNetOutboxInitializer.cs index fbcbdc17..d6096341 100644 --- a/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SqlServerAdoNetOutboxInitializer.cs +++ b/tests/NetEvolve.Pulse.Tests.Integration/Internals/Outbox/SqlServerAdoNetOutboxInitializer.cs @@ -36,8 +36,7 @@ public async ValueTask CreateDatabaseAsync(IServiceProvider serviceProvider, Can var options = serviceProvider.GetRequiredService>().Value; - var connectionString = - options.ConnectionString + var connectionString = options.ConnectionString ?? throw new InvalidOperationException("OutboxOptions.ConnectionString is not configured."); var schema = string.IsNullOrWhiteSpace(options.Schema) ? OutboxMessageSchema.DefaultSchema : options.Schema; diff --git a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/AuditInspectorEndpointsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/AuditInspectorEndpointsTests.cs index e298c2b9..25af0321 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/AuditInspectorEndpointsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/AuditInspectorEndpointsTests.cs @@ -620,12 +620,8 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetStatisticsAsync(Arg.Any()).Returns(statistics); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) ) .ConfigureAwait(false); var client = host.GetTestClient(); @@ -661,18 +657,14 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetByIdAsync(recordId, Arg.Any()).Returns(record); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => - { - options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; - options.SerializerOptions.Converters.Add( - new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) - ); - }) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => + { + options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; + options.SerializerOptions.Converters.Add( + new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) + ); + }) ) .ConfigureAwait(false); var client = host.GetTestClient(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/CommandDeadLetterInspectorEndpointsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/CommandDeadLetterInspectorEndpointsTests.cs index 0c0ca71b..e6737d1e 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/CommandDeadLetterInspectorEndpointsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/CommandDeadLetterInspectorEndpointsTests.cs @@ -670,12 +670,8 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetStatisticsAsync(Arg.Any()).Returns(statistics); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) ) .ConfigureAwait(false); var client = host.GetTestClient(); @@ -712,18 +708,14 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetEntryAsync(entryId, Arg.Any()).Returns(entry); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => - { - options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; - options.SerializerOptions.Converters.Add( - new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) - ); - }) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => + { + options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; + options.SerializerOptions.Converters.Add( + new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) + ); + }) ) .ConfigureAwait(false); var client = host.GetTestClient(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/Grpc/PulseGrpcStreamServiceTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/Grpc/PulseGrpcStreamServiceTests.cs index e59c94d4..a0eb6e4e 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/Grpc/PulseGrpcStreamServiceTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/Grpc/PulseGrpcStreamServiceTests.cs @@ -261,11 +261,8 @@ public async Task StreamAsync_WithMap_WritesMappedItemsInOrder(CancellationToken var writer = new CollectingStreamWriter(); await new TestStreamService(mediator.Object) - .StreamMapped( - new TestStreamQuery(), - writer, - new TestServerCallContext(CancellationToken.None), - item => item.ToUpperInvariant() + .StreamMapped(new TestStreamQuery(), writer, new TestServerCallContext(CancellationToken.None), item => + item.ToUpperInvariant() ) .ConfigureAwait(false); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/OutboxInspectorEndpointsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/OutboxInspectorEndpointsTests.cs index 433938e7..6e72e29c 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/OutboxInspectorEndpointsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/OutboxInspectorEndpointsTests.cs @@ -971,12 +971,8 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetStatisticsAsync(Arg.Any()).Returns(statistics); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => options.SerializerOptions.PropertyNamingPolicy = null) ) .ConfigureAwait(false); var client = host.GetTestClient(); @@ -1077,18 +1073,14 @@ CancellationToken cancellationToken var mock = Mock.Of(); _ = mock.GetMessageAsync(messageId, Arg.Any()).Returns(message); - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => - { - options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; - options.SerializerOptions.Converters.Add( - new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) - ); - }) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => + { + options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower; + options.SerializerOptions.Converters.Add( + new JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) + ); + }) ) .ConfigureAwait(false); var client = host.GetTestClient(); @@ -1167,14 +1159,8 @@ CancellationToken cancellationToken .Returns(messages); // Mirrors a NativeAOT application without reflection resolver: only the Pulse contracts can resolve the models. - using var host = await CreateTestHostAsync( - mock.Object, - null, - cancellationToken, - services => - services.ConfigureHttpJsonOptions(options => - options.SerializerOptions.TypeInfoResolverChain.Clear() - ) + using var host = await CreateTestHostAsync(mock.Object, null, cancellationToken, services => + services.ConfigureHttpJsonOptions(options => options.SerializerOptions.TypeInfoResolverChain.Clear()) ) .ConfigureAwait(false); var client = host.GetTestClient(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/AzureQueueStorage/AzureQueueStorageExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/AzureQueueStorage/AzureQueueStorageExtensionsTests.cs index d18ec43e..46207736 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/AzureQueueStorage/AzureQueueStorageExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/AzureQueueStorage/AzureQueueStorageExtensionsTests.cs @@ -22,9 +22,8 @@ public void UseAzureQueueStorageTransport_ConnectionString_When_configurator_is_ { IMediatorBuilder? configurator = null; - _ = Assert.Throws( - "configurator", - () => configurator!.UseAzureQueueStorageTransport(FakeConnectionString) + _ = Assert.Throws("configurator", () => + configurator!.UseAzureQueueStorageTransport(FakeConnectionString) ); } @@ -33,9 +32,8 @@ public void UseAzureQueueStorageTransport_ConnectionString_When_connectionString { IServiceCollection services = new ServiceCollection(); _ = services.AddPulse(config => - _ = Assert.Throws( - "connectionString", - () => config.UseAzureQueueStorageTransport((string)null!) + _ = Assert.Throws("connectionString", () => + config.UseAzureQueueStorageTransport((string)null!) ) ); } @@ -45,9 +43,8 @@ public void UseAzureQueueStorageTransport_Uri_When_configurator_is_null_throws_A { IMediatorBuilder? configurator = null; - _ = Assert.Throws( - "configurator", - () => configurator!.UseAzureQueueStorageTransport(FakeServiceUri) + _ = Assert.Throws("configurator", () => + configurator!.UseAzureQueueStorageTransport(FakeServiceUri) ); } @@ -56,9 +53,8 @@ public void UseAzureQueueStorageTransport_Uri_When_uri_is_null_throws_ArgumentNu { IServiceCollection services = new ServiceCollection(); _ = services.AddPulse(config => - _ = Assert.Throws( - "queueServiceUri", - () => config.UseAzureQueueStorageTransport((Uri)null!) + _ = Assert.Throws("queueServiceUri", () => + config.UseAzureQueueStorageTransport((Uri)null!) ) ); } @@ -146,16 +142,11 @@ public async Task UseAzureQueueStorageTransport_ConnectionString_default_options public async Task UseAzureQueueStorageTransport_ConnectionString_configureOptions_is_applied() { IServiceCollection services = new ServiceCollection(); - _ = services.AddPulse(config => - config.UseAzureQueueStorageTransport( - FakeConnectionString, - options => - { - options.QueueName = "my-queue"; - options.CreateQueueIfNotExists = false; - } - ) - ); + _ = services.AddPulse(config => config.UseAzureQueueStorageTransport(FakeConnectionString, options => + { + options.QueueName = "my-queue"; + options.CreateQueueIfNotExists = false; + })); var provider = services.BuildServiceProvider(); await using (provider.ConfigureAwait(false)) diff --git a/tests/NetEvolve.Pulse.Tests.Unit/CommandBatchTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/CommandBatchTests.cs index 0ff12780..fd9087b3 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/CommandBatchTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/CommandBatchTests.cs @@ -63,9 +63,8 @@ public async Task SendBatchAsync_WithNullMediator_ThrowsArgumentNullException(Ca IMediatorSendOnly? mediator = null; var batch = new CommandBatch(); - _ = await Assert.ThrowsAsync( - "mediator", - async () => await mediator.SendBatchAsync(batch, cancellationToken).ConfigureAwait(false) + _ = await Assert.ThrowsAsync("mediator", async () => + await mediator.SendBatchAsync(batch, cancellationToken).ConfigureAwait(false) ); } @@ -86,9 +85,8 @@ public async Task SendBatchAsync_WithNullBatch_ThrowsArgumentNullException(Cance var mediator = scope.ServiceProvider.GetRequiredService(); CommandBatch? batch = null; - _ = await Assert.ThrowsAsync( - "batch", - async () => await mediator.SendBatchAsync(batch!, cancellationToken).ConfigureAwait(false) + _ = await Assert.ThrowsAsync("batch", async () => + await mediator.SendBatchAsync(batch!, cancellationToken).ConfigureAwait(false) ); } } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/ConcurrentCommandGuardExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/ConcurrentCommandGuardExtensionsTests.cs index bcc777aa..0784bbde 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/ConcurrentCommandGuardExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/ConcurrentCommandGuardExtensionsTests.cs @@ -71,9 +71,8 @@ public void AddConcurrentCommandGuard_TypedWithNullConfigurator_ThrowsArgumentNu { IMediatorBuilder? configurator = null; - _ = Assert.Throws( - "configurator", - () => configurator!.AddConcurrentCommandGuard() + _ = Assert.Throws("configurator", () => + configurator!.AddConcurrentCommandGuard() ); } @@ -123,9 +122,8 @@ public void AddConcurrentCommandGuard_VoidWithNullConfigurator_ThrowsArgumentNul { IMediatorBuilder? configurator = null; - _ = Assert.Throws( - "configurator", - () => configurator!.AddConcurrentCommandGuard() + _ = Assert.Throws("configurator", () => + configurator!.AddConcurrentCommandGuard() ); } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/CosmosDb/CosmosDbOutboxRepositoryTimeToLiveTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/CosmosDb/CosmosDbOutboxRepositoryTimeToLiveTests.cs index ad7d0e5c..c8d09a4c 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/CosmosDb/CosmosDbOutboxRepositoryTimeToLiveTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/CosmosDb/CosmosDbOutboxRepositoryTimeToLiveTests.cs @@ -101,9 +101,8 @@ public async Task MarkAsCompletedAsync_WithTtlEnabled_PatchesTtlToTtlSeconds(Can cancellationToken.ThrowIfCancellationRequested(); var messageId = Guid.NewGuid(); - var patches = await SettleAsync( - messageId, - repository => repository.MarkAsCompletedAsync(messageId, cancellationToken) + var patches = await SettleAsync(messageId, repository => + repository.MarkAsCompletedAsync(messageId, cancellationToken) ) .ConfigureAwait(false); @@ -116,9 +115,8 @@ public async Task MarkAsDeadLetterAsync_WithTtlEnabled_PatchesTtlToTtlSeconds(Ca cancellationToken.ThrowIfCancellationRequested(); var messageId = Guid.NewGuid(); - var patches = await SettleAsync( - messageId, - repository => repository.MarkAsDeadLetterAsync(messageId, "boom", cancellationToken) + var patches = await SettleAsync(messageId, repository => + repository.MarkAsDeadLetterAsync(messageId, "boom", cancellationToken) ) .ConfigureAwait(false); @@ -131,9 +129,8 @@ public async Task MarkAsFailedAsync_WithTtlEnabled_PatchesTtlToNeverExpire(Cance cancellationToken.ThrowIfCancellationRequested(); var messageId = Guid.NewGuid(); - var patches = await SettleAsync( - messageId, - repository => repository.MarkAsFailedAsync(messageId, "boom", cancellationToken) + var patches = await SettleAsync(messageId, repository => + repository.MarkAsFailedAsync(messageId, "boom", cancellationToken) ) .ConfigureAwait(false); @@ -148,15 +145,8 @@ CancellationToken cancellationToken cancellationToken.ThrowIfCancellationRequested(); var messageId = Guid.NewGuid(); - var patches = await SettleAsync( - messageId, - repository => - repository.MarkAsFailedAsync( - messageId, - "boom", - DateTimeOffset.UtcNow.AddMinutes(5), - cancellationToken - ) + var patches = await SettleAsync(messageId, repository => + repository.MarkAsFailedAsync(messageId, "boom", DateTimeOffset.UtcNow.AddMinutes(5), cancellationToken) ) .ConfigureAwait(false); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs index e15dc2f0..ec5b45ce 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs @@ -323,9 +323,8 @@ public async Task UseEventDispatcherFor_WithFactory_WithNullFactory_ThrowsArgume var builder = new MediatorBuilder(services); Func? factory = null; - _ = Assert.Throws( - "factory", - () => builder.UseEventDispatcherFor(factory!) + _ = Assert.Throws("factory", () => + builder.UseEventDispatcherFor(factory!) ); } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/Internals/PulseMediatorTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/Internals/PulseMediatorTests.cs index 8e3c4e0c..4fca9a5c 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/Internals/PulseMediatorTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/Internals/PulseMediatorTests.cs @@ -20,9 +20,8 @@ public async Task Constructor_WithNullLogger_ThrowsArgumentNullException() var serviceProvider = new ServiceCollection().BuildServiceProvider(); var timeProvider = TimeProvider.System; - _ = Assert.Throws( - "logger", - () => _ = new PulseMediator(logger!, serviceProvider, timeProvider) + _ = Assert.Throws("logger", () => + _ = new PulseMediator(logger!, serviceProvider, timeProvider) ); } @@ -36,9 +35,8 @@ public async Task Constructor_WithNullServiceProvider_ThrowsArgumentNullExceptio IServiceProvider? serviceProvider = null; var timeProvider = TimeProvider.System; - _ = Assert.Throws( - "serviceProvider", - () => _ = new PulseMediator(logger, serviceProvider!, timeProvider) + _ = Assert.Throws("serviceProvider", () => + _ = new PulseMediator(logger, serviceProvider!, timeProvider) ); } @@ -52,9 +50,8 @@ public async Task Constructor_WithNullTimeProvider_ThrowsArgumentNullException() var serviceProvider = new ServiceCollection().BuildServiceProvider(); TimeProvider? timeProvider = null; - _ = Assert.Throws( - "timeProvider", - () => _ = new PulseMediator(logger, serviceProvider, timeProvider!) + _ = Assert.Throws("timeProvider", () => + _ = new PulseMediator(logger, serviceProvider, timeProvider!) ); } @@ -89,9 +86,8 @@ public async Task PublishAsync_WithNullMessage_ThrowsArgumentNullException(Cance var timeProvider = TimeProvider.System; var mediator = new PulseMediator(logger, serviceProvider, timeProvider); - _ = await Assert.ThrowsAsync( - "message", - async () => await mediator.PublishAsync(null!, cancellationToken).ConfigureAwait(false) + _ = await Assert.ThrowsAsync("message", async () => + await mediator.PublishAsync(null!, cancellationToken).ConfigureAwait(false) ); } @@ -210,9 +206,8 @@ public async Task QueryAsync_WithNullQuery_ThrowsArgumentNullException(Cancellat var timeProvider = TimeProvider.System; var mediator = new PulseMediator(logger, serviceProvider, timeProvider); - _ = await Assert.ThrowsAsync( - "query", - async () => await mediator.QueryAsync(null!, cancellationToken).ConfigureAwait(false) + _ = await Assert.ThrowsAsync("query", async () => + await mediator.QueryAsync(null!, cancellationToken).ConfigureAwait(false) ); } @@ -271,9 +266,8 @@ public async Task SendAsync_WithNullCommand_ThrowsArgumentNullException(Cancella var timeProvider = TimeProvider.System; var mediator = new PulseMediator(logger, serviceProvider, timeProvider); - _ = await Assert.ThrowsAsync( - "command", - async () => await mediator.SendAsync(null!, cancellationToken).ConfigureAwait(false) + _ = await Assert.ThrowsAsync("command", async () => + await mediator.SendAsync(null!, cancellationToken).ConfigureAwait(false) ); } @@ -655,9 +649,8 @@ public async Task StreamQueryAsync_WithNullQuery_ThrowsArgumentNullException(Can var timeProvider = TimeProvider.System; var mediator = new PulseMediator(logger, serviceProvider, timeProvider); - _ = Assert.Throws( - "query", - () => mediator.StreamQueryAsync(null!, cancellationToken) + _ = Assert.Throws("query", () => + mediator.StreamQueryAsync(null!, cancellationToken) ); } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlAuditTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlAuditTests.cs index fef1a2ea..b6ee13ce 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlAuditTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlAuditTests.cs @@ -125,9 +125,8 @@ await management public async Task AddMySqlAuditStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - MySqlAuditMediatorBuilderExtensions.AddMySqlAuditStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + MySqlAuditMediatorBuilderExtensions.AddMySqlAuditStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlCommandDeadLetterTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlCommandDeadLetterTests.cs index ecbe19c8..e3fda7a1 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlCommandDeadLetterTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlCommandDeadLetterTests.cs @@ -229,9 +229,8 @@ public async Task Management_Constructor_WithValidArguments_CreatesInstance() public async Task AddMySqlCommandDeadLetterStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - MySqlCommandDeadLetterMediatorBuilderExtensions.AddMySqlCommandDeadLetterStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + MySqlCommandDeadLetterMediatorBuilderExtensions.AddMySqlCommandDeadLetterStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlIdempotencyMediatorBuilderExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlIdempotencyMediatorBuilderExtensionsTests.cs index 3bc453f4..a3412b99 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlIdempotencyMediatorBuilderExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/MySql/MySqlIdempotencyMediatorBuilderExtensionsTests.cs @@ -108,9 +108,8 @@ public async Task AddMySqlIdempotencyStore_WithConfigureOptions_AppliesOptions() { var services = new ServiceCollection(); _ = services.AddPulse(config => - config.AddMySqlIdempotencyStore( - "Server=localhost;Database=mydb;", - options => options.TableName = "CustomIdempotencyKey" + config.AddMySqlIdempotencyStore("Server=localhost;Database=mydb;", options => + options.TableName = "CustomIdempotencyKey" ) ); @@ -127,9 +126,8 @@ public async Task AddMySqlIdempotencyStore_WithConfigureOptions_AppliesOptions() public async Task AddMySqlIdempotencyStore_WithFactory_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - MySqlIdempotencyMediatorBuilderExtensions.AddMySqlIdempotencyStore( - null!, - _ => "Server=localhost;Database=mydb;" + MySqlIdempotencyMediatorBuilderExtensions.AddMySqlIdempotencyStore(null!, _ => + "Server=localhost;Database=mydb;" ) ) .Throws(); @@ -209,9 +207,8 @@ public async Task AddMySqlIdempotencyStore_WithFactory_WithConfigureOptions_Appl public async Task AddMySqlIdempotencyStore_WithAction_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - MySqlIdempotencyMediatorBuilderExtensions.AddMySqlIdempotencyStore( - null!, - opts => opts.ConnectionString = "Server=localhost;Database=mydb;" + MySqlIdempotencyMediatorBuilderExtensions.AddMySqlIdempotencyStore(null!, opts => + opts.ConnectionString = "Server=localhost;Database=mydb;" ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/NativeAotInterceptorExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/NativeAotInterceptorExtensionsTests.cs index f38cb364..eb840b1c 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/NativeAotInterceptorExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/NativeAotInterceptorExtensionsTests.cs @@ -28,9 +28,8 @@ public void AddNativeAotCommandInterceptors_WithNullServices_ThrowsArgumentNullE { IServiceCollection? services = null; - _ = Assert.Throws( - "services", - () => services!.AddNativeAotCommandInterceptors() + _ = Assert.Throws("services", () => + services!.AddNativeAotCommandInterceptors() ); } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxEventStoreTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxEventStoreTests.cs index 7b373b31..5d3d3255 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxEventStoreTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxEventStoreTests.cs @@ -25,9 +25,8 @@ public async Task Constructor_WithNullRepository_ThrowsArgumentNullException() { IOutboxRepository? repository = null; - _ = Assert.Throws( - "repository", - () => _ = new OutboxEventStore(repository!, TimeProvider.System, new StubPayloadSerializer()) + _ = Assert.Throws("repository", () => + _ = new OutboxEventStore(repository!, TimeProvider.System, new StubPayloadSerializer()) ); await Task.CompletedTask.ConfigureAwait(false); @@ -38,9 +37,8 @@ public async Task Constructor_WithNullTimeProvider_ThrowsArgumentNullException() { var repository = new TrackingOutboxRepository(); - _ = Assert.Throws( - "timeProvider", - () => _ = new OutboxEventStore(repository, null!, new StubPayloadSerializer()) + _ = Assert.Throws("timeProvider", () => + _ = new OutboxEventStore(repository, null!, new StubPayloadSerializer()) ); await Task.CompletedTask.ConfigureAwait(false); @@ -51,9 +49,8 @@ public async Task Constructor_WithNullPayloadSerializer_ThrowsArgumentNullExcept { var repository = new TrackingOutboxRepository(); - _ = Assert.Throws( - "payloadSerializer", - () => _ = new OutboxEventStore(repository, TimeProvider.System, null!) + _ = Assert.Throws("payloadSerializer", () => + _ = new OutboxEventStore(repository, TimeProvider.System, null!) ); await Task.CompletedTask.ConfigureAwait(false); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxProcessorHostedServiceTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxProcessorHostedServiceTests.cs index 9aebd881..d05fa497 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxProcessorHostedServiceTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxProcessorHostedServiceTests.cs @@ -32,17 +32,15 @@ public async Task Constructor_WithNullScopeFactory_ThrowsArgumentNullException() var options = Options.Create(new OutboxProcessorOptions()); var logger = CreateLogger(); - _ = Assert.Throws( - "scopeFactory", - () => - _ = new OutboxProcessorHostedService( - scopeFactory!, - transport, - CreateLifetime(), - options, - logger, - TimeProvider.System - ) + _ = Assert.Throws("scopeFactory", () => + _ = new OutboxProcessorHostedService( + scopeFactory!, + transport, + CreateLifetime(), + options, + logger, + TimeProvider.System + ) ); } @@ -54,17 +52,15 @@ public async Task Constructor_WithNullTransport_ThrowsArgumentNullException() var options = Options.Create(new OutboxProcessorOptions()); var logger = CreateLogger(); - _ = Assert.Throws( - "transport", - () => - _ = new OutboxProcessorHostedService( - CreateScopeFactory(repository), - transport!, - CreateLifetime(), - options, - logger, - TimeProvider.System - ) + _ = Assert.Throws("transport", () => + _ = new OutboxProcessorHostedService( + CreateScopeFactory(repository), + transport!, + CreateLifetime(), + options, + logger, + TimeProvider.System + ) ); } @@ -76,17 +72,15 @@ public async Task Constructor_WithNullOptions_ThrowsArgumentNullException() IOptions? options = null; var logger = CreateLogger(); - _ = Assert.Throws( - "options", - () => - _ = new OutboxProcessorHostedService( - CreateScopeFactory(repository), - transport, - CreateLifetime(), - options!, - logger, - TimeProvider.System - ) + _ = Assert.Throws("options", () => + _ = new OutboxProcessorHostedService( + CreateScopeFactory(repository), + transport, + CreateLifetime(), + options!, + logger, + TimeProvider.System + ) ); } @@ -98,17 +92,15 @@ public async Task Constructor_WithNullLogger_ThrowsArgumentNullException() var options = Options.Create(new OutboxProcessorOptions()); ILogger? logger = null; - _ = Assert.Throws( - "logger", - () => - _ = new OutboxProcessorHostedService( - CreateScopeFactory(repository), - transport, - CreateLifetime(), - options, - logger!, - TimeProvider.System - ) + _ = Assert.Throws("logger", () => + _ = new OutboxProcessorHostedService( + CreateScopeFactory(repository), + transport, + CreateLifetime(), + options, + logger!, + TimeProvider.System + ) ); } @@ -121,17 +113,15 @@ public async Task Constructor_WithNullLifetime_ThrowsArgumentNullException() var options = Options.Create(new OutboxProcessorOptions()); var logger = CreateLogger(); - _ = Assert.Throws( - "lifetime", - () => - _ = new OutboxProcessorHostedService( - CreateScopeFactory(repository), - transport, - lifetime!, - options, - logger, - TimeProvider.System - ) + _ = Assert.Throws("lifetime", () => + _ = new OutboxProcessorHostedService( + CreateScopeFactory(repository), + transport, + lifetime!, + options, + logger, + TimeProvider.System + ) ); } @@ -144,17 +134,15 @@ public async Task Constructor_WithNullTimeProvider_ThrowsArgumentNullException() var logger = CreateLogger(); TimeProvider? timeProvider = null; - _ = Assert.Throws( - "timeProvider", - () => - _ = new OutboxProcessorHostedService( - CreateScopeFactory(repository), - transport, - CreateLifetime(), - options, - logger, - timeProvider! - ) + _ = Assert.Throws("timeProvider", () => + _ = new OutboxProcessorHostedService( + CreateScopeFactory(repository), + transport, + CreateLifetime(), + options, + logger, + timeProvider! + ) ); } diff --git a/tests/NetEvolve.Pulse.Tests.Unit/Polly/PollyExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/Polly/PollyExtensionsTests.cs index fd64830f..2d8595c4 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/Polly/PollyExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/Polly/PollyExtensionsTests.cs @@ -62,9 +62,8 @@ public async Task AddPollyRequestPolicies_RegistersPipelineAndInterceptor() public async Task AddPollyRequestPolicies_WithKeyedInterceptorRegistration_DoesNotThrow() { var services = new ServiceCollection(); - _ = services.AddKeyedSingleton>( - "keyed", - (_, _) => Mock.Of>().Object + _ = services.AddKeyedSingleton>("keyed", (_, _) => + Mock.Of>().Object ); _ = services.AddPulse(configurator => @@ -82,9 +81,8 @@ public async Task AddPollyRequestPolicies_WithKeyedInterceptorRegistration_DoesN public async Task AddPollyStreamQueryPolicies_WithKeyedInterceptorRegistration_DoesNotThrow() { var services = new ServiceCollection(); - _ = services.AddKeyedSingleton>( - "keyed", - (_, _) => Mock.Of>().Object + _ = services.AddKeyedSingleton>("keyed", (_, _) => + Mock.Of>().Object ); _ = services.AddPulse(configurator => diff --git a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlAuditTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlAuditTests.cs index 00d09659..a87af968 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlAuditTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlAuditTests.cs @@ -143,9 +143,8 @@ await management public async Task AddPostgreSqlAuditStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - PostgreSqlAuditMediatorBuilderExtensions.AddPostgreSqlAuditStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + PostgreSqlAuditMediatorBuilderExtensions.AddPostgreSqlAuditStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlCommandDeadLetterTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlCommandDeadLetterTests.cs index 8b2df939..1f5e4da9 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlCommandDeadLetterTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlCommandDeadLetterTests.cs @@ -240,9 +240,8 @@ public async Task Management_Constructor_WithValidArguments_CreatesInstance() public async Task AddPostgreSqlCommandDeadLetterStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - PostgreSqlCommandDeadLetterMediatorBuilderExtensions.AddPostgreSqlCommandDeadLetterStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + PostgreSqlCommandDeadLetterMediatorBuilderExtensions.AddPostgreSqlCommandDeadLetterStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlIdempotencyMediatorBuilderExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlIdempotencyMediatorBuilderExtensionsTests.cs index 186a9f4f..df1fc545 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlIdempotencyMediatorBuilderExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlIdempotencyMediatorBuilderExtensionsTests.cs @@ -124,9 +124,8 @@ public async Task AddPostgreSqlIdempotencyStore_WithConfigureOptions_AppliesOpti public async Task AddPostgreSqlIdempotencyStore_WithFactory_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - PostgreSqlIdempotencyMediatorBuilderExtensions.AddPostgreSqlIdempotencyStore( - null!, - _ => "Host=localhost;Encrypt=true;" + PostgreSqlIdempotencyMediatorBuilderExtensions.AddPostgreSqlIdempotencyStore(null!, _ => + "Host=localhost;Encrypt=true;" ) ) .Throws(); @@ -206,9 +205,8 @@ public async Task AddPostgreSqlIdempotencyStore_WithFactory_WithConfigureOptions public async Task AddPostgreSqlIdempotencyStore_WithAction_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - PostgreSqlIdempotencyMediatorBuilderExtensions.AddPostgreSqlIdempotencyStore( - null!, - opts => opts.ConnectionString = "Host=localhost;Encrypt=true;" + PostgreSqlIdempotencyMediatorBuilderExtensions.AddPostgreSqlIdempotencyStore(null!, opts => + opts.ConnectionString = "Host=localhost;Encrypt=true;" ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteAuditTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteAuditTests.cs index 8aa88018..f5e8a0d2 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteAuditTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteAuditTests.cs @@ -161,9 +161,8 @@ public async Task Management_Constructor_WithInvalidTableName_ThrowsArgumentExce public async Task AddSQLiteAuditStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SQLiteAuditMediatorBuilderExtensions.AddSQLiteAuditStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + SQLiteAuditMediatorBuilderExtensions.AddSQLiteAuditStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteCommandDeadLetterTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteCommandDeadLetterTests.cs index 76d9d23d..3ffb855d 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteCommandDeadLetterTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteCommandDeadLetterTests.cs @@ -235,9 +235,8 @@ public async Task Management_Constructor_WithInvalidTableName_ThrowsArgumentExce public async Task AddSQLiteCommandDeadLetterStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SQLiteCommandDeadLetterMediatorBuilderExtensions.AddSQLiteCommandDeadLetterStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + SQLiteCommandDeadLetterMediatorBuilderExtensions.AddSQLiteCommandDeadLetterStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteIdempotencyMediatorBuilderExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteIdempotencyMediatorBuilderExtensionsTests.cs index c30640e9..7efafb5f 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteIdempotencyMediatorBuilderExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteIdempotencyMediatorBuilderExtensionsTests.cs @@ -105,9 +105,8 @@ public async Task AddSQLiteIdempotencyStore_WithConfigureOptions_AppliesOptions( { var services = new ServiceCollection(); _ = services.AddPulse(config => - config.AddSQLiteIdempotencyStore( - "Data Source=:memory:", - options => options.TableName = "CustomIdempotencyKeys" + config.AddSQLiteIdempotencyStore("Data Source=:memory:", options => + options.TableName = "CustomIdempotencyKeys" ) ); @@ -203,9 +202,8 @@ public async Task AddSQLiteIdempotencyStore_WithFactory_WithConfigureOptions_App public async Task AddSQLiteIdempotencyStore_WithAction_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SQLiteIdempotencyMediatorBuilderExtensions.AddSQLiteIdempotencyStore( - null!, - opts => opts.ConnectionString = "Data Source=:memory:" + SQLiteIdempotencyMediatorBuilderExtensions.AddSQLiteIdempotencyStore(null!, opts => + opts.ConnectionString = "Data Source=:memory:" ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerAuditTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerAuditTests.cs index 1a600baa..f3c3de28 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerAuditTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerAuditTests.cs @@ -155,9 +155,8 @@ public async Task Management_Constructor_WithMaliciousSchema_ThrowsArgumentExcep public async Task AddSqlServerAuditStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SqlServerAuditMediatorBuilderExtensions.AddSqlServerAuditStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + SqlServerAuditMediatorBuilderExtensions.AddSqlServerAuditStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerCommandDeadLetterTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerCommandDeadLetterTests.cs index 186d5403..62bfb9c1 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerCommandDeadLetterTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerCommandDeadLetterTests.cs @@ -276,9 +276,8 @@ public async Task Management_Constructor_WithMaliciousSchema_ThrowsArgumentExcep public async Task AddSqlServerCommandDeadLetterStore_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SqlServerCommandDeadLetterMediatorBuilderExtensions.AddSqlServerCommandDeadLetterStore( - null!, - opts => opts.ConnectionString = ValidConnectionString + SqlServerCommandDeadLetterMediatorBuilderExtensions.AddSqlServerCommandDeadLetterStore(null!, opts => + opts.ConnectionString = ValidConnectionString ) ) .Throws(); diff --git a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerIdempotencyMediatorBuilderExtensionsTests.cs b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerIdempotencyMediatorBuilderExtensionsTests.cs index 2b79415c..3443b4c5 100644 --- a/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerIdempotencyMediatorBuilderExtensionsTests.cs +++ b/tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerIdempotencyMediatorBuilderExtensionsTests.cs @@ -124,9 +124,8 @@ public async Task AddSqlServerIdempotencyStore_WithConfigureOptions_AppliesOptio public async Task AddSqlServerIdempotencyStore_WithFactory_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SqlServerIdempotencyMediatorBuilderExtensions.AddSqlServerIdempotencyStore( - null!, - _ => "Server=.;Encrypt=true;" + SqlServerIdempotencyMediatorBuilderExtensions.AddSqlServerIdempotencyStore(null!, _ => + "Server=.;Encrypt=true;" ) ) .Throws(); @@ -206,9 +205,8 @@ public async Task AddSqlServerIdempotencyStore_WithFactory_WithConfigureOptions_ public async Task AddSqlServerIdempotencyStore_WithAction_WithNullConfigurator_ThrowsArgumentNullException() => _ = await Assert .That(() => - SqlServerIdempotencyMediatorBuilderExtensions.AddSqlServerIdempotencyStore( - null!, - opts => opts.ConnectionString = "Server=.;Encrypt=true;" + SqlServerIdempotencyMediatorBuilderExtensions.AddSqlServerIdempotencyStore(null!, opts => + opts.ConnectionString = "Server=.;Encrypt=true;" ) ) .Throws();