From b3346eb07a5701d0d48a1655ebe7327d77dae835 Mon Sep 17 00:00:00 2001 From: Ian Cooper Date: Thu, 16 May 2024 08:14:00 +0100 Subject: [PATCH] Archiver Dependencies (#3090) * Move archive functionality to external service bus, prevent need for archiver to take a direct Outbox dependency * Move archiver function to bus; organize CP tests * Test that external bus archive works as expected * Add tests around archiving async messages * Add a test to show we only archive dispatched * Ensure tests for archiving cover the boundary conditions * Fix issues with the setup not taking in the new ArchiverProvider dependency for the bus --- .../ServiceCollectionExtensions.cs | 8 +- .../HostedServiceCollectionExtensions.cs | 2 +- .../TimedOutboxArchiver.cs | 38 +- .../TimedOutboxArchiverOptions.cs | 10 - src/Paramore.Brighter/CommandProcessor.cs | 21 +- .../ExternalBusConfiguration.cs | 11 +- src/Paramore.Brighter/ExternalBusService.cs | 489 ++++++++++-------- .../IAmAnExternalBusService.cs | 22 +- .../InMemoryArchiveProvider.cs | 35 ++ src/Paramore.Brighter/OutboxArchiver.cs | 45 +- ..._Archiving_Old_Messages_From_The_Outbox.cs | 150 ++++++ ...ving_Old_Messages_From_The_Outbox_Async.cs | 156 ++++++ ...ling_A_Server_Via_The_Command_Processor.cs | 2 +- ...The_Command_Processor_With_No_In_Mapper.cs | 2 +- ...he_Command_Processor_With_No_Out_Mapper.cs | 2 +- ...a_The_Command_Processor_With_No_Timeout.cs | 2 +- ..._PostBox_On_The_Command_Processor_Async.cs | 4 +- ...PostBox_On_The_Command_Processor _Async.cs | 2 +- ...ng_The_PostBox_On_The_Command_Processor.cs | 2 +- ...ng_The_PostBox_On_The_Command_Processor.cs | 2 +- ..._PostBox_On_The_Command_Processor_Async.cs | 3 +- ...ag_Should_Be_Accessible_In_The_Handler.cs} | 2 +- ...positing_A_Message_In_The_Message_Store.cs | 5 +- ...ing_A_Message_In_The_Message_StoreAsync.cs | 2 +- ..._Message_In_The_Message_StoreAsync_Bulk.cs | 2 +- ...ing_A_Message_In_The_Message_Store_Bulk.cs | 2 +- ..._A_Handler_Is_Part_Of_An_Async_Pipeline.cs | 4 +- .../When_A_Handler_Is_Part_of_A_Pipeline.cs | 2 +- ...eption_Is_Thrown_Terminate_The_Pipeline.cs | 6 +- .../When_Building_A_Handler_For_A_Command.cs | 2 +- ...Building_A_Handler_For_An_Async_Command.cs | 2 +- ...lding_A_Pipeline_Allow_ForiegnAttribues.cs | 4 +- ...ing_A_Pipeline_Allow_Pre_And_Post_Tasks.cs | 4 +- ..._Failures_Should_Be_ConfigurationErrors.cs | 2 +- ..._Building_A_Pipeline_Preserve_The_Order.cs | 4 +- ...n_Building_A_Pipeline_With_Global_Inbox.cs | 6 +- ...With_Global_Inbox_And_NoInbox_Attribute.cs | 4 +- ...obal_Inbox_And_NoInbox_Attribute_Async .cs | 4 +- ...ipeline_With_Global_Inbox_And_Use_Inbox.cs | 10 +- ...e_With_Global_Inbox_And_Use_Inbox_Async.cs | 10 +- ...ding_A_Pipeline_With_Global_Inbox_Async.cs | 6 +- ...line_With_Global_Inbox_Override_Context.cs | 6 +- ...A_Sync_Pipeline_That_Has_Async_Handlers.cs | 4 +- ...n_Async_Pipeline_Allow_ForiegnAttribues.cs | 4 +- ...Async_Pipeline_Allow_Pre_And_Post_Tasks.cs | 4 +- ..._Failures_Should_Be_ConfigurationErrors.cs | 2 +- ...ng_An_Async_Pipeline_Preserve_The_Order.cs | 4 +- ...n_Async_Pipeline_That_Has_Sync_Handlers.cs | 4 +- ..._Finding_A_Hander_That_Has_Dependencies.cs | 2 +- .../When_Finding_A_Handler_For_A_Command.cs | 2 +- ...Default_Inbox_Into_The_Publish_Pipeline.cs | 10 +- ...t_Inbox_Into_The_Publish_Pipeline_Async.cs | 8 +- ..._A_Default_Inbox_Into_The_Send_Pipeline.cs | 10 +- ...ault_Inbox_Into_The_Send_Pipeline_Async.cs | 10 +- ...e_Is_No_Sync_Or_Async_Handler_Factories.cs | 2 +- ...ised_The_Pipeline_Cleanup_Its_Handlers.cs} | 2 +- ...And_There_Is_No_Message_Mapper_Registry.cs | 3 +- ...ere_Is_No_Message_Mapper_Registry_Async.cs | 2 +- ...essage_And_There_Is_No_Message_Producer.cs | 3 +- ...age_And_There_Is_No_Message_Transformer.cs | 2 +- ...d_There_Is_No_Message_Transformer_Async.cs | 2 +- ...ting_A_Message_To_The_Command_Processor.cs | 2 +- ..._Message_To_The_Command_Processor_Async.cs | 2 +- ..._Limit_Total_Writes_To_OutBox_In_Window.cs | 2 +- .../When_Posting_Via_A_Control_Bus_Sender.cs | 2 +- ..._Posting_Via_A_Control_Bus_Sender_Async.cs | 2 +- .../When_Posting_With_A_Default_Policy.cs | 2 +- ...Posting_With_An_In_Memory_Message_Store.cs | 2 +- ...g_With_An_In_Memory_Message_Store_Async.cs | 2 +- ...ibers_Should_Aggregate_Exceptions_Async.cs | 6 +- .../When_There_Are_Multiple_Subscribers.cs} | 6 +- ...en_There_Are_Multiple_Subscribers_Async.cs | 6 +- ...hen_There_Are_No_Command_Handlers_Async.cs | 6 +- .../When_There_Are_No_Subscribers.cs} | 2 +- .../When_There_Are_No_Subscribers_Async.cs | 2 +- ...en_publishing_an_event_to_the_processor.cs | 2 +- ...subscribers_should_aggregate_exceptions.cs | 6 +- .../When_there_are_no_command_handlers.cs | 6 +- .../When_Cancelling_An_Async_Command.cs | 2 +- ...ending_A_Command_To_The_Processor_Async.cs | 2 +- ...hen_Sending_A_command_To_The_Processor.cs} | 2 +- ...Are_Multiple_Possible_Command_Handlers.cs} | 6 +- ...ultiple_Possible_Command_Handlers_Async.cs | 6 +- ...s_execute_all_the_steps_in_the_pipeline.cs | 6 +- 84 files changed, 823 insertions(+), 436 deletions(-) create mode 100644 src/Paramore.Brighter/InMemoryArchiveProvider.cs create mode 100644 tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox.cs create mode 100644 tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox_Async.cs rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Call}/When_Calling_A_Server_Via_The_Command_Processor.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Call}/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Call}/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Call}/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Clear}/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Clear}/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Clear}/When_Clearing_The_PostBox_On_The_Command_Processor.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Clear}/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Clear}/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_putting_a_variable_into_the_bag_should_be_accessible_in_the_handler.cs => Context/When_Putting_A_Variable_Into_The_Bag_Should_Be_Accessible_In_The_Handler.cs} (96%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Deposit}/When_Depositing_A_Message_In_The_Message_Store.cs (95%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Deposit}/When_Depositing_A_Message_In_The_Message_StoreAsync.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Deposit}/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs (99%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Deposit}/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs (99%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_A_Handler_Is_Part_of_A_Pipeline.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Handler_For_A_Command.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Handler_For_An_Async_Command.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs (95%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_Preserve_The_Order.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_Async.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs (96%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs (96%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs (95%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_An_Async_Pipeline_Preserve_The_Order.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs (96%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Finding_A_Hander_That_Has_Dependencies.cs (96%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Finding_A_Handler_For_A_Command.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Pipeline}/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_we_have_exercised_the_pipeline_cleanup_its_handlers.cs => Pipeline/When_We_Have_Exercised_The_Pipeline_Cleanup_Its_Handlers.cs} (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_To_The_Command_Processor.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_A_Message_To_The_Command_Processor_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_Via_A_Control_Bus_Sender.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_Via_A_Control_Bus_Sender_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_With_A_Default_Policy.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_With_An_In_Memory_Message_Store.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Post}/When_Posting_With_An_In_Memory_Message_Store_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_there_are_multiple_subscribers.cs => Publish/When_There_Are_Multiple_Subscribers.cs} (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_There_Are_Multiple_Subscribers_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_There_Are_No_Command_Handlers_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_there_are_no_subscribers.cs => Publish/When_There_Are_No_Subscribers.cs} (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_There_Are_No_Subscribers_Async.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_publishing_an_event_to_the_processor.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Publish}/When_there_are_no_command_handlers.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Send}/When_Cancelling_An_Async_Command.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Send}/When_Sending_A_Command_To_The_Processor_Async.cs (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_sending_a_command_to_the_processor.cs => Send/When_Sending_A_command_To_The_Processor.cs} (97%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{When_there_are_multiple_possible_command_handlers.cs => Send/When_There_Are_Multiple_Possible_Command_Handlers.cs} (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Send}/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs (98%) rename tests/Paramore.Brighter.Core.Tests/CommandProcessors/{ => Send}/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs (98%) diff --git a/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs b/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs index ae3da8c647..22849f6f0e 100644 --- a/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs @@ -216,7 +216,7 @@ public static IBrighterBuilder UseExternalBus( brighterBuilder.Services.TryAdd(new ServiceDescriptor(typeof(IAmAnExternalBusService), (serviceProvider) => BuildExternalBus( - serviceProvider, transactionType, busConfiguration, brighterBuilder.PolicyRegistry, outbox + serviceProvider, transactionType, busConfiguration, brighterBuilder.PolicyRegistry, outbox, busConfiguration.ArchiveProvider ), ServiceLifetime.Singleton)); @@ -314,7 +314,7 @@ private static IAmAnExternalBusService BuildExternalBus(IServiceProvider service Type transactionType, ExternalBusConfiguration busConfiguration, IPolicyRegistry policyRegistry, - IAmAnOutbox outbox) + IAmAnOutbox outbox, IAmAnArchiveProvider archiver = null) { //Because the bus has specialized types as members, we need to create the bus type dynamically //again to prevent someone configuring Brighter from having to pass generic types @@ -327,11 +327,13 @@ private static IAmAnExternalBusService BuildExternalBus(IServiceProvider service TransformFactory(serviceProvider), TransformFactoryAsync(serviceProvider), outbox, + archiver, busConfiguration.OutboxBulkChunkSize, busConfiguration.OutboxTimeout, busConfiguration.MaxOutStandingMessages, busConfiguration.MaxOutStandingCheckIntervalMilliSeconds, - busConfiguration.OutBoxBag); + busConfiguration.OutBoxBag, + busConfiguration.ArchiveBatchSize); } /// diff --git a/src/Paramore.Brighter.Extensions.Hosting/HostedServiceCollectionExtensions.cs b/src/Paramore.Brighter.Extensions.Hosting/HostedServiceCollectionExtensions.cs index 4e38bce4be..bbc0a386be 100644 --- a/src/Paramore.Brighter.Extensions.Hosting/HostedServiceCollectionExtensions.cs +++ b/src/Paramore.Brighter.Extensions.Hosting/HostedServiceCollectionExtensions.cs @@ -33,7 +33,7 @@ public static IBrighterBuilder UseOutboxArchiver(this IBrighterBui brighterBuilder.Services.TryAddSingleton(options); brighterBuilder.Services.AddSingleton(archiveProvider); - brighterBuilder.Services.AddHostedService>(); + brighterBuilder.Services.AddHostedService(); return brighterBuilder; } diff --git a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiver.cs b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiver.cs index f35c6abac8..1ce795a81b 100644 --- a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiver.cs +++ b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiver.cs @@ -9,38 +9,28 @@ namespace Paramore.Brighter.Extensions.Hosting { - public class TimedOutboxArchiver : IHostedService, IDisposable where TMessage : Message + public class TimedOutboxArchiver( + IServiceScopeFactory serviceScopeFactory, + TimedOutboxArchiverOptions options) + : IHostedService, IDisposable { - private readonly TimedOutboxArchiverOptions _options; private static readonly ILogger s_logger = ApplicationLogging.CreateLogger(); - private readonly IAmAnOutbox _outbox; - private readonly IAmAnArchiveProvider _archiveProvider; private Timer _timer; private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); - public TimedOutboxArchiver( - IAmAnOutbox outbox, - IAmAnArchiveProvider archiveProvider, - TimedOutboxArchiverOptions options) - { - _outbox = outbox; - _archiveProvider = archiveProvider; - _options = options; - } - public Task StartAsync(CancellationToken cancellationToken) { - s_logger.LogInformation("Outbox Archiver Service is starting."); + s_logger.LogInformation("Outbox Archiver Service is starting"); - _timer = new Timer(async (e) => await Archive(e, cancellationToken), null, TimeSpan.Zero, TimeSpan.FromSeconds(_options.TimerInterval)); + _timer = new Timer(async (e) => await Archive(e, cancellationToken), null, TimeSpan.Zero, TimeSpan.FromSeconds(options.TimerInterval)); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) { - s_logger.LogInformation("Outbox Archiver Service is stopping."); + s_logger.LogInformation("Outbox Archiver Service is stopping"); _timer?.Change(Timeout.Infinite, 0); @@ -56,19 +46,17 @@ private async Task Archive(object state, CancellationToken cancellationToken) { if (await _semaphore.WaitAsync(TimeSpan.Zero, cancellationToken)) { + var scope = serviceScopeFactory.CreateScope(); s_logger.LogInformation("Outbox Archiver looking for messages to Archive"); try { - var outBoxArchiver = new OutboxArchiver( - _outbox, - _archiveProvider, - _options.BatchSize); - - await outBoxArchiver.ArchiveAsync(_options.MinimumAge, cancellationToken, _options.ParallelArchiving); + IAmAnExternalBusService externalBusService = scope.ServiceProvider.GetService(); + + await externalBusService.ArchiveAsync(options.MinimumAge, cancellationToken); } catch (Exception e) { - s_logger.LogError(e, "Error while sweeping the outbox."); + s_logger.LogError(e, "Error while sweeping the outbox"); } finally { @@ -79,7 +67,7 @@ private async Task Archive(object state, CancellationToken cancellationToken) } else { - s_logger.LogWarning("Outbox Archiver is still running - abandoning attempt."); + s_logger.LogWarning("Outbox Archiver is still running - abandoning attempt"); } } diff --git a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiverOptions.cs b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiverOptions.cs index 1edc614e57..d54cc5e700 100644 --- a/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiverOptions.cs +++ b/src/Paramore.Brighter.Extensions.Hosting/TimedOutboxArchiverOptions.cs @@ -7,19 +7,9 @@ public class TimedOutboxArchiverOptions /// public int TimerInterval { get; set; } = 15; - /// - /// The maximum number of messages to dispatch. - /// - public int BatchSize { get; set; } = 100; - /// /// The minimum age in hours to Archive /// public int MinimumAge { get; set; } = 24; - - /// - /// Send messages to the archive provider in parallel - /// - public bool ParallelArchiving { get; set; } = false; } } diff --git a/src/Paramore.Brighter/CommandProcessor.cs b/src/Paramore.Brighter/CommandProcessor.cs index e1dbb1bd55..89b4304c4d 100644 --- a/src/Paramore.Brighter/CommandProcessor.cs +++ b/src/Paramore.Brighter/CommandProcessor.cs @@ -797,7 +797,7 @@ public TResponse Call(T request, int timeOutInMilliseconds) //we do this to create the channel on the broker, or we won't have anything to send to; we //retry in case the subscription is poor. An alternative would be to extract the code from //the channel to create the subscription, but this does not do much on a new queue - _bus.Retry(() => responseChannel.Purge()); + Retry(() => responseChannel.Purge()); var outMessage = _bus.CreateMessageFromRequest(request); @@ -810,7 +810,7 @@ public TResponse Call(T request, int timeOutInMilliseconds) //now we block on the receiver to try and get the message, until timeout. s_logger.LogDebug("Awaiting response on {ChannelName}", channelName); - _bus.Retry(() => responseMessage = responseChannel.Receive(timeOutInMilliseconds)); + Retry(() => responseMessage = responseChannel.Receive(timeOutInMilliseconds)); TResponse response = default(TResponse); if (responseMessage.Header.MessageType != MessageType.MT_NONE) @@ -907,6 +907,23 @@ private bool HandlerFactoryIsNotEitherIAmAHandlerFactorySyncOrAsync(IAmAHandlerF } } + private bool Retry(Action action) + { + var policy = _policyRegistry.Get(CommandProcessor.RETRYPOLICY); + var result = policy.ExecuteAndCapture(action); + if (result.Outcome != OutcomeType.Successful) + { + if (result.FinalException != null) + { + s_logger.LogError(result.FinalException, "Exception whilst trying to publish message"); + } + + return false; + } + + return true; + } + private IEnumerable> SplitRequestBatchIntoTypes(IEnumerable requests) { return requests.GroupBy(r => r.GetType()); diff --git a/src/Paramore.Brighter/ExternalBusConfiguration.cs b/src/Paramore.Brighter/ExternalBusConfiguration.cs index 3ce8456c34..2a1932d226 100644 --- a/src/Paramore.Brighter/ExternalBusConfiguration.cs +++ b/src/Paramore.Brighter/ExternalBusConfiguration.cs @@ -114,6 +114,16 @@ public interface IAmExternalBusConfiguration /// public class ExternalBusConfiguration : IAmExternalBusConfiguration { + /// + /// How big should the batch size be for archiving messages + /// + public int ArchiveBatchSize { get; set; } + + /// + /// If we want to archive messages, abstracts archival storage + /// + public IAmAnArchiveProvider ArchiveProvider { get; set; } + /// /// How do obtain a connection to the Outbox that is not part of a shared transaction. /// NOTE: Must implement IAmARelationalDbConnectionProvider @@ -199,7 +209,6 @@ public class ExternalBusConfiguration : IAmExternalBusConfiguration /// public bool UseRpc { get; set; } - /// /// Initializes a new instance of the class. /// diff --git a/src/Paramore.Brighter/ExternalBusService.cs b/src/Paramore.Brighter/ExternalBusService.cs index 7155fa194c..ca5bae6821 100644 --- a/src/Paramore.Brighter/ExternalBusService.cs +++ b/src/Paramore.Brighter/ExternalBusService.cs @@ -16,15 +16,12 @@ namespace Paramore.Brighter /// Provide services to CommandProcessor that persist across the lifetime of the application. Allows separation from elements that have a lifetime linked /// to the scope of a request, or are transient for DI purposes /// - public class ExternalBusService : IAmAnExternalBusService - where TMessage : Message + public class ExternalBusService : IAmAnExternalBusService where TMessage : Message { private static readonly ILogger s_logger = ApplicationLogging.CreateLogger(); private readonly IPolicyRegistry _policyRegistry; - private readonly IAmAMessageMapperRegistry _mapperRegistry; - private readonly IAmAMessageTransformerFactory _messageTransformerFactory; - private readonly IAmAMessageTransformerFactoryAsync _messageTransformerFactoryAsync; + private readonly IAmAnArchiveProvider _archiveProvider; private readonly TransformPipelineBuilder _transformPipelineBuilder; private readonly TransformPipelineBuilderAsync _transformPipelineBuilderAsync; private readonly IAmAnOutboxSync _outBox; @@ -32,13 +29,18 @@ public class ExternalBusService : IAmAnExternalBusServic private readonly int _outboxTimeout; private readonly int _outboxBulkChunkSize; private readonly IAmAProducerRegistry _producerRegistry; - + private readonly int _archiveBatchSize; + + private static readonly SemaphoreSlim s_clearSemaphoreToken = new SemaphoreSlim(1, 1); + private static readonly SemaphoreSlim s_backgroundClearSemaphoreToken = new SemaphoreSlim(1, 1); + //Used to checking the limit on outstanding messages for an Outbox. We throw at that point. Writes to the static bool should be made thread-safe by locking the object private static readonly SemaphoreSlim s_checkOutstandingSemaphoreToken = new SemaphoreSlim(1, 1); private const string ADDMESSAGETOOUTBOX = "Add message to outbox"; + private const string ARCHIVE_OUTBOX = "Archive Outbox"; private const string BULKDISPATCHMESSAGE = "Bulk dispatching messages"; private const string DEPOSITPOST = "Deposit Post"; private const string DISPATCHMESSAGE = "Dispatching message"; @@ -62,50 +64,58 @@ public class ExternalBusService : IAmAnExternalBusServic /// The factory used to create a transformer pipeline for a message mapper /// The factory used to create a transformer pipeline for an async message mapper /// An outbox for transactional messaging, if none is provided, use an InMemoryOutbox + /// When archiving rows from the Outbox, abstracts to where we should send them /// The size of a chunk for bulk work /// How long to timeout for with an outbox /// How many messages can become outstanding in the Outbox before we throw an OutboxLimitReached exception /// How long before we check for maxOutStandingMessages /// An outbox may require additional arguments, such as a topic list to search - public ExternalBusService( - IAmAProducerRegistry producerRegistry, + /// What batch size to use when archiving from the Outbox + public ExternalBusService(IAmAProducerRegistry producerRegistry, IPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageTransformerFactory messageTransformerFactory, IAmAMessageTransformerFactoryAsync messageTransformerFactoryAsync, IAmAnOutbox outbox = null, + IAmAnArchiveProvider archiveProvider = null, int outboxBulkChunkSize = 100, int outboxTimeout = 300, int maxOutStandingMessages = -1, int maxOutStandingCheckIntervalMilliSeconds = 1000, - Dictionary outBoxBag = null) - { - _producerRegistry = producerRegistry ?? throw new ConfigurationException("Missing Producer Registry for External Bus Services"); - _policyRegistry = policyRegistry?? throw new ConfigurationException("Missing Policy Registry for External Bus Services"); - _mapperRegistry = mapperRegistry; - _messageTransformerFactory = messageTransformerFactory; - _messageTransformerFactoryAsync = messageTransformerFactoryAsync; - - if (mapperRegistry is null) - throw new ConfigurationException("A Command Processor with an external bus must have a message mapper registry that implements IAmAMessageMapperRegistry"); + Dictionary outBoxBag = null, + int archiveBatchSize = 100) + { + _producerRegistry = producerRegistry ?? + throw new ConfigurationException("Missing Producer Registry for External Bus Services"); + _policyRegistry = policyRegistry ?? + throw new ConfigurationException("Missing Policy Registry for External Bus Services"); + _archiveProvider = archiveProvider; + + if (mapperRegistry is null) + throw new ConfigurationException( + "A Command Processor with an external bus must have a message mapper registry that implements IAmAMessageMapperRegistry"); if (mapperRegistry is not IAmAMessageMapperRegistryAsync mapperRegistryAsync) - throw new ConfigurationException("A Command Processor with an external bus must have a message mapper registry that implements IAmAMessageMapperRegistryAsync"); + throw new ConfigurationException( + "A Command Processor with an external bus must have a message mapper registry that implements IAmAMessageMapperRegistryAsync"); if (messageTransformerFactory is null || messageTransformerFactoryAsync is null) - throw new ConfigurationException("A Command Processor with an external bus must have a message transformer factory"); - + throw new ConfigurationException( + "A Command Processor with an external bus must have a message transformer factory"); + _transformPipelineBuilder = new TransformPipelineBuilder(mapperRegistry, messageTransformerFactory); - _transformPipelineBuilderAsync = new TransformPipelineBuilderAsync(mapperRegistryAsync, messageTransformerFactoryAsync); + _transformPipelineBuilderAsync = + new TransformPipelineBuilderAsync(mapperRegistryAsync, messageTransformerFactoryAsync); //default to in-memory; expectation for a in memory box is Message and CommittableTransaction if (outbox is null) outbox = new InMemoryOutbox(TimeProvider.System); if (outbox is IAmAnOutboxSync syncOutbox) _outBox = syncOutbox; if (outbox is IAmAnOutboxAsync asyncOutbox) _asyncOutbox = asyncOutbox; - + _outboxBulkChunkSize = outboxBulkChunkSize; _outboxTimeout = outboxTimeout; _maxOutStandingMessages = maxOutStandingMessages; _maxOutStandingCheckIntervalMilliSeconds = maxOutStandingCheckIntervalMilliSeconds; _outBoxBag = outBoxBag; + _archiveBatchSize = archiveBatchSize; ConfigureCallbacks(); } @@ -184,7 +194,8 @@ public async Task AddToOutboxAsync( var written = await RetryAsync( async ct => { - await _asyncOutbox.AddAsync(chunk, _outboxTimeout, overridingTransactionProvider, ct).ConfigureAwait(continueOnCapturedContext); + await _asyncOutbox.AddAsync(chunk, _outboxTimeout, overridingTransactionProvider, ct) + .ConfigureAwait(continueOnCapturedContext); }, continueOnCapturedContext, cancellationToken).ConfigureAwait(continueOnCapturedContext); @@ -221,7 +232,7 @@ public void AddToOutbox( public void AddToOutbox( IEnumerable messages, IAmABoxTransactionProvider overridingTransactionProvider = null - ) + ) { CheckOutboxOutstandingLimit(); @@ -235,6 +246,76 @@ public void AddToOutbox( } } + /// + /// Archive Message from the outbox to the outbox archive provider + /// Throws any archiving exception + /// + /// Minimum age in hours + public void Archive(int millisecondsDispatchedSince) + { + try + { + var messages = _outBox.DispatchedMessages(millisecondsDispatchedSince, _archiveBatchSize); + + s_logger.LogInformation( + "Found {NumberOfMessageArchived} message to archive to {MessagesToArchive}, batch size : {BatchSize}", + messages.Count(), _archiveBatchSize + ); + + if (!messages.Any()) return; + + foreach (var message in messages) + { + _archiveProvider.ArchiveMessage(message); + } + + _outBox.Delete(messages.Select(e => e.Id).ToArray()); + + s_logger.LogInformation( + "Successfully archived {NumberOfMessageArchived}, batch size : {BatchSize}", + messages.Count(), + _archiveBatchSize + ); + } + catch (Exception e) + { + s_logger.LogError(e, "Error while archiving from the outbox"); + throw; + } + } + + /// + /// Archive Message from the outbox to the outbox archive provider + /// Throws any archiving exception + /// + /// + /// The Cancellation Token + public async Task ArchiveAsync(int millisecondsDispatchedSince, CancellationToken cancellationToken) + { + try + { + var messages = await _asyncOutbox.DispatchedMessagesAsync( + millisecondsDispatchedSince, _archiveBatchSize, cancellationToken: cancellationToken + ); + + if (!messages.Any()) return; + + foreach (var message in messages) + { + await _archiveProvider.ArchiveMessageAsync(message, cancellationToken); + } + + await _asyncOutbox.DeleteAsync(messages.Select(e => e.Id).ToArray(), + cancellationToken: cancellationToken + ); + } + catch (Exception e) + { + s_logger.LogError(e, "Error while archiving from the outbox"); + throw; + } + } + /// /// Used with RPC to call a remote service via the external bus /// @@ -337,7 +418,7 @@ public void ClearOutbox( { var span = Activity.Current; span?.AddTag("amountToClear", amountToClear); - span?.AddTag("minimumAge", minimumAge); + span?.AddTag("millisecondsSinceSent", minimumAge); span?.AddTag("async", useAsync); span?.AddTag("bulk", useBulk); @@ -358,7 +439,7 @@ public void ClearOutbox( Task.Run(() => BackgroundDispatchUsingSync(amountToClear, minimumAge, args)); } } - + /// /// Given a request, run the transformation pipeline to create a message /// @@ -388,7 +469,7 @@ public async Task CreateMessageFromRequestAsync(TRequest requ AddTelemetryToMessage(message); return message; } - + /// /// Given a set of messages, map them to requests /// @@ -397,30 +478,30 @@ public async Task CreateMessageFromRequestAsync(TRequest requ /// /// public Task> CreateMessagesFromRequests( - Type requestType, + Type requestType, IEnumerable requests, CancellationToken cancellationToken) { var parameters = new object[] { requests, cancellationToken }; - var hasAsyncPipeline = (bool) typeof(TransformPipelineBuilderAsync) + var hasAsyncPipeline = (bool)typeof(TransformPipelineBuilderAsync) .GetMethod(nameof(TransformPipelineBuilderAsync.HasPipeline), BindingFlags.Instance | BindingFlags.Public) .MakeGenericMethod(requestType) .Invoke(this._transformPipelineBuilderAsync, null); - + if (hasAsyncPipeline) { - return (Task>) GetType() + return (Task>)GetType() .GetMethod(nameof(BulkMapMessagesAsync), BindingFlags.Instance | BindingFlags.NonPublic) .MakeGenericMethod(requestType) - .Invoke(this, parameters); + .Invoke(this, parameters); } - + var tcs = new TaskCompletionSource>(); tcs.SetResult((List)GetType() .GetMethod(nameof(BulkMapMessages), BindingFlags.Instance | BindingFlags.NonPublic) - .MakeGenericMethod(requestType) + .MakeGenericMethod(requestType) .Invoke(this, new[] { requests })); return tcs.Task; } @@ -448,85 +529,13 @@ public void CreateRequestFromMessage(Message message, out TRequest req request = _transformPipelineBuilder .BuildUnwrapPipeline() .Unwrap(message); - - } + } else { throw new ArgumentOutOfRangeException("No message mapper defined for request"); } - } - - private void AddTelemetryToMessage(Message message) - { - var activity = Activity.Current ?? - ApplicationTelemetry.ActivitySource.StartActivity(DEPOSITPOST, ActivityKind.Producer); - - if (activity != null) - { - message.Header.AddTelemetryInformation(activity, typeof(T).ToString()); - } - } - - /// - /// Configure the callbacks for the producers - /// - private void ConfigureCallbacks() - { - //Only register one, to avoid two callbacks where we support both interfaces on a producer - foreach (var producer in _producerRegistry.Producers) - { - if (!ConfigurePublisherCallbackMaybe(producer)) - ConfigureAsyncPublisherCallbackMaybe(producer); - } } - /// - /// If a producer supports a callback then we can use this to mark a message as dispatched in an asynchronous - /// Outbox - /// - /// The producer to add a callback for - /// - private void ConfigureAsyncPublisherCallbackMaybe(IAmAMessageProducer producer) - { - if (producer is ISupportPublishConfirmation producerSync) - { - producerSync.OnMessagePublished += async delegate(bool success, string id) - { - if (success) - { - s_logger.LogInformation("Sent message: Id:{Id}", id); - if (_asyncOutbox != null) - await RetryAsync(async ct => - await _asyncOutbox.MarkDispatchedAsync(id, DateTime.UtcNow, cancellationToken: ct)); - } - }; - } - } - - /// - /// If a producer supports a callback then we can use this to mark a message as dispatched in a synchronous - /// Outbox - /// - /// The producer to add a callback for - private bool ConfigurePublisherCallbackMaybe(IAmAMessageProducer producer) - { - if (producer is ISupportPublishConfirmation producerSync) - { - producerSync.OnMessagePublished += delegate(bool success, string id) - { - if (success) - { - s_logger.LogInformation("Sent message: Id:{Id}", id); - if (_outBox != null) - Retry(() => _outBox.MarkDispatched(id, DateTime.UtcNow)); - } - }; - return true; - } - - return false; - } - /// /// Do we have an async outbox defined? /// @@ -545,34 +554,24 @@ public bool HasOutbox() return _outBox != null; } - /// - /// Retry an action via the policy engine - /// - /// The Action to try - /// - public bool Retry(Action action) + + private void AddTelemetryToMessage(Message message) { - var policy = _policyRegistry.Get(CommandProcessor.RETRYPOLICY); - var result = policy.ExecuteAndCapture(action); - if (result.Outcome != OutcomeType.Successful) - { - if (result.FinalException != null) - { - s_logger.LogError(result.FinalException, "Exception whilst trying to publish message"); - CheckOutstandingMessages(); - } + var activity = Activity.Current ?? + ApplicationTelemetry.ActivitySource.StartActivity(DEPOSITPOST, ActivityKind.Producer); - return false; + if (activity != null) + { + message.Header.AddTelemetryInformation(activity, typeof(T).ToString()); } - - return true; } - + + private async Task BackgroundDispatchUsingSync( - int amountToClear, - int minimumAge, + int amountToClear, + int millisecondsSinceSent, Dictionary args - ) + ) { var span = Activity.Current; if (await s_backgroundClearSemaphoreToken.WaitAsync(TimeSpan.Zero)) @@ -580,7 +579,7 @@ Dictionary args await s_clearSemaphoreToken.WaitAsync(CancellationToken.None); try { - var messages = _outBox.OutstandingMessages(minimumAge, amountToClear, args: args); + var messages = _outBox.OutstandingMessages(millisecondsSinceSent, amountToClear, args: args); span?.AddEvent(new ActivityEvent(GETMESSAGESFROMOUTBOX, tags: new ActivityTagsCollection { { "Outstanding Messages", messages.Count() } })); s_logger.LogInformation("Found {NumberOfMessages} to clear out of amount {AmountToClear}", @@ -610,8 +609,11 @@ Dictionary args s_logger.LogInformation("Skipping dispatch of messages as another thread is running"); } } - - private async Task BackgroundDispatchUsingAsync(int amountToClear, int minimumAge, bool useBulk, + + private async Task BackgroundDispatchUsingAsync( + int amountToClear, + int milliSecondsSinceSent, + bool useBulk, Dictionary args) { var span = Activity.Current; @@ -621,7 +623,7 @@ private async Task BackgroundDispatchUsingAsync(int amountToClear, int minimumAg try { var messages = - await _asyncOutbox.OutstandingMessagesAsync(minimumAge, amountToClear, args: args); + await _asyncOutbox.OutstandingMessagesAsync(milliSecondsSinceSent, amountToClear, args: args); span?.AddEvent(new ActivityEvent(GETMESSAGESFROMOUTBOX)); s_logger.LogInformation("Found {NumberOfMessages} to clear out of amount {AmountToClear}", @@ -660,7 +662,76 @@ private async Task BackgroundDispatchUsingAsync(int amountToClear, int minimumAg s_logger.LogInformation("Skipping dispatch of messages as another thread is running"); } } - + + private async Task BulkDispatchAsync(IEnumerable posts, CancellationToken cancellationToken) + { + var span = Activity.Current; + //Chunk into Topics + var messagesByTopic = posts.GroupBy(m => m.Header.Topic); + + foreach (var topicBatch in messagesByTopic) + { + var producer = _producerRegistry.LookupBy(topicBatch.Key); + + if (producer is IAmABulkMessageProducerAsync bulkMessageProducer) + { + var messages = topicBatch.ToArray(); + s_logger.LogInformation("Bulk Dispatching {NumberOfMessages} for Topic {TopicName}", + messages.Length, topicBatch.Key); + span?.AddEvent(new ActivityEvent(BULKDISPATCHMESSAGE, + tags: new ActivityTagsCollection + { + { "Topic", topicBatch.Key }, { "Number Of Messages", messages.Length } + })); + var dispatchesMessages = bulkMessageProducer.SendAsync(messages, cancellationToken); + + await foreach (var successfulMessage in dispatchesMessages) + { + if (!(producer is ISupportPublishConfirmation)) + { + await RetryAsync(async ct => await _asyncOutbox.MarkDispatchedAsync( + successfulMessage, DateTime.UtcNow, cancellationToken: cancellationToken), + cancellationToken: cancellationToken); + } + } + } + else + { + throw new InvalidOperationException("No async bulk message producer defined."); + } + } + } + + private List BulkMapMessages(IEnumerable requests) where T : class, IRequest + { + return requests.Select(r => + { + var publication = _producerRegistry.LookupPublication(); + var wrapPipeline = _transformPipelineBuilder.BuildWrapPipeline(); + var message = wrapPipeline.Wrap((T)r, publication); + AddTelemetryToMessage(message); + return message; + }).ToList(); + } + + private async Task> BulkMapMessagesAsync( + IEnumerable requests, + CancellationToken cancellationToken = default + ) where T : class, IRequest + { + var messages = new List(); + foreach (var request in requests) + { + var publication = _producerRegistry.LookupPublication(); + var wrapPipeline = _transformPipelineBuilderAsync.BuildWrapPipeline(); + var message = await wrapPipeline.WrapAsync((T)request, publication, cancellationToken); + AddTelemetryToMessage(message); + messages.Add(message); + } + + return messages; + } + private IEnumerable> ChunkMessages(IEnumerable messages) { return Enumerable.Range(0, (int)Math.Ceiling((messages.Count() / (decimal)_outboxBulkChunkSize))) @@ -675,10 +746,11 @@ private void CheckOutboxOutstandingLimit() bool hasOutBox = (_outBox != null || _asyncOutbox != null); if (!hasOutBox) return; - + s_logger.LogDebug("Outbox outstanding message count is: {OutstandingMessageCount}", _outStandingCount); // Because a thread recalculates this, we may always be in a delay, so we check on entry for the next outstanding item - bool exceedsOutstandingMessageLimit = _maxOutStandingMessages != -1 && _outStandingCount > _maxOutStandingMessages; + bool exceedsOutstandingMessageLimit = + _maxOutStandingMessages != -1 && _outStandingCount > _maxOutStandingMessages; if (exceedsOutstandingMessageLimit) throw new OutboxLimitReachedException( @@ -707,7 +779,53 @@ private void CheckOutstandingMessages() //This is expensive, so use a background thread Task.Run(() => OutstandingMessagesCheck()); } - + + private void ConfigureCallbacks() + { + //Only register one, to avoid two callbacks where we support both interfaces on a producer + foreach (var producer in _producerRegistry.Producers) + { + if (!ConfigurePublisherCallbackMaybe(producer)) + ConfigureAsyncPublisherCallbackMaybe(producer); + } + } + + private void ConfigureAsyncPublisherCallbackMaybe(IAmAMessageProducer producer) + { + if (producer is ISupportPublishConfirmation producerSync) + { + producerSync.OnMessagePublished += async delegate(bool success, string id) + { + if (success) + { + s_logger.LogInformation("Sent message: Id:{Id}", id); + if (_asyncOutbox != null) + await RetryAsync(async ct => + await _asyncOutbox.MarkDispatchedAsync(id, DateTime.UtcNow, cancellationToken: ct)); + } + }; + } + } + + private bool ConfigurePublisherCallbackMaybe(IAmAMessageProducer producer) + { + if (producer is ISupportPublishConfirmation producerSync) + { + producerSync.OnMessagePublished += delegate(bool success, string id) + { + if (success) + { + s_logger.LogInformation("Sent message: Id:{Id}", id); + if (_outBox != null) + Retry(() => _outBox.MarkDispatched(id, DateTime.UtcNow)); + } + }; + return true; + } + + return false; + } + private void Dispatch(IEnumerable posts, Dictionary args = null) { foreach (var message in posts) @@ -740,73 +858,6 @@ private void Dispatch(IEnumerable posts, Dictionary arg throw new InvalidOperationException("No sync message producer defined."); } } - - private async Task BulkDispatchAsync(IEnumerable posts, CancellationToken cancellationToken) - { - var span = Activity.Current; - //Chunk into Topics - var messagesByTopic = posts.GroupBy(m => m.Header.Topic); - - foreach (var topicBatch in messagesByTopic) - { - var producer = _producerRegistry.LookupBy(topicBatch.Key); - - if (producer is IAmABulkMessageProducerAsync bulkMessageProducer) - { - var messages = topicBatch.ToArray(); - s_logger.LogInformation("Bulk Dispatching {NumberOfMessages} for Topic {TopicName}", - messages.Length, topicBatch.Key); - span?.AddEvent(new ActivityEvent(BULKDISPATCHMESSAGE, - tags: new ActivityTagsCollection - { - { "Topic", topicBatch.Key }, { "Number Of Messages", messages.Length } - })); - var dispatchesMessages = bulkMessageProducer.SendAsync(messages, cancellationToken); - - await foreach (var successfulMessage in dispatchesMessages) - { - if (!(producer is ISupportPublishConfirmation)) - { - await RetryAsync(async ct => await _asyncOutbox.MarkDispatchedAsync( - successfulMessage, DateTime.UtcNow, cancellationToken: cancellationToken), - cancellationToken: cancellationToken); - } - } - } - else - { - throw new InvalidOperationException("No async bulk message producer defined."); - } - } - } - - private List BulkMapMessages(IEnumerable requests) where T : class, IRequest - { - return requests.Select(r => - { - var publication = _producerRegistry.LookupPublication(); - var wrapPipeline = _transformPipelineBuilder.BuildWrapPipeline(); - var message = wrapPipeline.Wrap((T)r, publication); - AddTelemetryToMessage(message); - return message; - }).ToList(); - } - - private async Task> BulkMapMessagesAsync(IEnumerable requests, - CancellationToken cancellationToken = default) where T : class, IRequest - { - var messages = new List(); - foreach (var request in requests) - { - var publication = _producerRegistry.LookupPublication(); - var wrapPipeline = _transformPipelineBuilderAsync.BuildWrapPipeline(); - var message = await wrapPipeline.WrapAsync((T)request,publication, cancellationToken); - AddTelemetryToMessage(message); - messages.Add(message); - } - - return messages; - } private async Task DispatchAsync(IEnumerable posts, bool continueOnCapturedContext, CancellationToken cancellationToken) @@ -855,7 +906,7 @@ await RetryAsync( throw new InvalidOperationException("No async message producer defined."); } } - + private Message MapMessage(TRequest request) where TRequest : class, IRequest { @@ -863,14 +914,14 @@ private Message MapMessage(TRequest request) if (publication == null) throw new ConfigurationException( $"No publication found for request {request.GetType().Name}"); - + Message message; if (_transformPipelineBuilder.HasPipeline()) { message = _transformPipelineBuilder .BuildWrapPipeline() .Wrap(request, publication); - } + } else { throw new ArgumentOutOfRangeException("No message mapper defined for request"); @@ -886,7 +937,7 @@ private async Task MapMessageAsync(TRequest request, Cancella if (publication == null) throw new ConfigurationException( $"No publication found for request {request.GetType().Name}"); - + Message message; if (_transformPipelineBuilderAsync.HasPipeline()) { @@ -915,7 +966,7 @@ private void OutstandingMessagesCheck() _outStandingCount = _outBox .OutstandingMessages( _maxOutStandingCheckIntervalMilliSeconds, - args: _outBoxBag + args: _outBoxBag ) .Count(); return; @@ -937,6 +988,24 @@ private void OutstandingMessagesCheck() } } + public bool Retry(Action action) + { + var policy = _policyRegistry.Get(CommandProcessor.RETRYPOLICY); + var result = policy.ExecuteAndCapture(action); + if (result.Outcome != OutcomeType.Successful) + { + if (result.FinalException != null) + { + s_logger.LogError(result.FinalException, "Exception whilst trying to publish message"); + CheckOutstandingMessages(); + } + + return false; + } + + return true; + } + private async Task RetryAsync(Func send, bool continueOnCapturedContext = false, CancellationToken cancellationToken = default) { diff --git a/src/Paramore.Brighter/IAmAnExternalBusService.cs b/src/Paramore.Brighter/IAmAnExternalBusService.cs index 544a0f2346..209605fbb5 100644 --- a/src/Paramore.Brighter/IAmAnExternalBusService.cs +++ b/src/Paramore.Brighter/IAmAnExternalBusService.cs @@ -7,6 +7,19 @@ namespace Paramore.Brighter { public interface IAmAnExternalBusService : IDisposable { + /// + /// Archive Message from the outbox to the outbox archive provider + /// + /// Minimum age in milliseconds + void Archive(int millisecondsDispatchedSince); + + /// + /// Archive Message from the outbox to the outbox archive provider + /// + /// + /// The Cancellation Token + Task ArchiveAsync(int millisecondsDispatchedSince, CancellationToken cancellationToken); + /// /// Used with RPC to call a remote service via the external bus /// @@ -107,14 +120,5 @@ void CreateRequestFromMessage(Message message, out TRequest request) /// /// true if defined bool HasOutbox(); - - /// - /// Retry an action via the policy engine - /// - /// The Action to try - /// - bool Retry(Action action); - - } } diff --git a/src/Paramore.Brighter/InMemoryArchiveProvider.cs b/src/Paramore.Brighter/InMemoryArchiveProvider.cs new file mode 100644 index 0000000000..3a480dd4eb --- /dev/null +++ b/src/Paramore.Brighter/InMemoryArchiveProvider.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Paramore.Brighter; + +/// +/// Use this archiver will result in messages being stored in memory. Mainly useful for tests. +/// Use the if you just want to discard and not archive +/// +public class InMemoryArchiveProvider: IAmAnArchiveProvider +{ + public Dictionary ArchivedMessages { get; set; } = new(); + + public void ArchiveMessage(Message message) + { + ArchivedMessages.Add(message.Id, message); + } + + public async Task ArchiveMessageAsync(Message message, CancellationToken cancellationToken) + { + ArchivedMessages.Add(message.Id, message); + } + + public async Task ArchiveMessagesAsync(Message[] messages, CancellationToken cancellationToken) + { + foreach (var message in messages) + { + ArchivedMessages.Add(message.Id, message); + } + + return messages.Select(m => m.Id).ToArray(); + } +} diff --git a/src/Paramore.Brighter/OutboxArchiver.cs b/src/Paramore.Brighter/OutboxArchiver.cs index a304960ecc..edf230eea5 100644 --- a/src/Paramore.Brighter/OutboxArchiver.cs +++ b/src/Paramore.Brighter/OutboxArchiver.cs @@ -39,30 +39,22 @@ namespace Paramore.Brighter /// The transaction type of the Db public class OutboxArchiver where TMessage: Message { + private readonly IAmAnExternalBusService _bus; private const string ARCHIVE_OUTBOX = "Archive Outbox"; - private readonly int _batchSize; - private readonly IAmAnOutboxSync _outboxSync; - private readonly IAmAnOutboxAsync _outboxAsync; - private readonly IAmAnArchiveProvider _archiveProvider; private readonly ILogger _logger = ApplicationLogging.CreateLogger>(); private const string SUCCESS_MESSAGE = "Successfully archiver {NumberOfMessageArchived} out of {MessagesToArchive}, batch size : {BatchSize}"; - public OutboxArchiver(IAmAnOutbox outbox,IAmAnArchiveProvider archiveProvider, int batchSize = 100) + public OutboxArchiver(IAmAnExternalBusService bus) { - _batchSize = batchSize; - if (outbox is IAmAnOutboxSync syncBox) - _outboxSync = syncBox; - - if (outbox is IAmAnOutboxAsync asyncBox) - _outboxAsync = asyncBox; - - _archiveProvider = archiveProvider; + _bus = bus; } /// /// Archive Message from the outbox to the outbox archive provider + /// Outbox Archiver will swallow any errors during the archive process, but record them. Assumption is + /// that these are transient errors which can be retried /// /// Minimum age in hours public void Archive(int minimumAge) @@ -71,22 +63,11 @@ public void Archive(int minimumAge) try { - var messages = _outboxSync.DispatchedMessages(minimumAge, _batchSize); - - if (!messages.Any()) return; - foreach (var message in messages) - { - _archiveProvider.ArchiveMessage(message); - } - - _outboxSync.Delete(messages.Select(e => e.Id).ToArray()); - _logger.LogInformation(SUCCESS_MESSAGE, messages.Count(), messages.Count(), _batchSize); + _bus.Archive(minimumAge); } catch (Exception e) { activity?.SetStatus(ActivityStatusCode.Error, e.Message); - _logger.LogError(e, "Error while archiving from the outbox"); - throw; } finally { @@ -97,29 +78,23 @@ public void Archive(int minimumAge) /// /// Archive Message from the outbox to the outbox archive provider + /// Outbox Archiver will swallow any errors during the archive process, but record them. Assumption is + /// that these are transient errors which can be retried /// /// Minimum age in hours /// The Cancellation Token /// Send messages to archive provider in parallel - public async Task ArchiveAsync(int minimumAge, CancellationToken cancellationToken, bool parallelArchiving = false) + public async Task ArchiveAsync(int minimumAge, CancellationToken cancellationToken) { var activity = ApplicationTelemetry.ActivitySource.StartActivity(ARCHIVE_OUTBOX, ActivityKind.Server); try { - var messages = await _outboxAsync.DispatchedMessagesAsync( - minimumAge, _batchSize, cancellationToken:cancellationToken); - - if (!messages.Any()) return; - - await _outboxAsync.DeleteAsync( - messages.Select(e => e.Id).ToArray(), cancellationToken: cancellationToken); + await _bus.ArchiveAsync(minimumAge, cancellationToken); } catch (Exception e) { activity?.SetStatus(ActivityStatusCode.Error, e.Message); - _logger.LogError(e, "Error while archiving from the outbox"); - throw; } finally { diff --git a/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox.cs b/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox.cs new file mode 100644 index 0000000000..9a03a12481 --- /dev/null +++ b/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Transactions; +using FluentAssertions; +using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; +using Polly; +using Polly.Registry; +using Xunit; + +namespace Paramore.Brighter.Core.Tests.Archiving; + +public class ServiceBusMessageStoreArchiverTests +{ + private readonly InMemoryOutbox _outbox; + private readonly InMemoryArchiveProvider _archiveProvider; + private readonly ExternalBusService _bus; + + public ServiceBusMessageStoreArchiverTests() + { + const string topic = "MyTopic"; + + var producer = new FakeMessageProducerWithPublishConfirmation{Publication = {Topic = new RoutingKey(topic), RequestType = typeof(MyCommand)}}; + + var messageMapperRegistry = new MessageMapperRegistry( + new SimpleMessageMapperFactory((_) => new MyCommandMessageMapper()), + null); + + var retryPolicy = Policy + .Handle() + .Retry(); + + var circuitBreakerPolicy = Policy + .Handle() + .CircuitBreaker(1, TimeSpan.FromMilliseconds(1)); + + var producerRegistry = new ProducerRegistry(new Dictionary + { + { topic, producer }, + }); + + var policyRegistry = new PolicyRegistry + { + { CommandProcessor.RETRYPOLICY, retryPolicy }, + { CommandProcessor.CIRCUITBREAKER, circuitBreakerPolicy } + }; + + var timeProvider = new FakeTimeProvider(); + _outbox = new InMemoryOutbox(timeProvider); + _archiveProvider = new InMemoryArchiveProvider(); + + _bus = new ExternalBusService( + producerRegistry, + policyRegistry, + messageMapperRegistry, + new EmptyMessageTransformerFactory(), + new EmptyMessageTransformerFactoryAsync(), + _outbox, + _archiveProvider + ); + } + + [Fact] + public void When_Archiving_All_Messages_From_The_Outbox() + { + //arrange + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageOne); + _outbox.MarkDispatched(messageOne.Id); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageTwo); + _outbox.MarkDispatched(messageTwo.Id); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageThree); + _outbox.MarkDispatched(messageThree.Id); + + //act + _outbox.EntryCount.Should().Be(3); + + _bus.Archive(20000); + + //assert + _outbox.EntryCount.Should().Be(0); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageThree.Id, messageThree)); + } + + [Fact] + public void When_Archiving_Some_Messages_From_The_Outbox() + { + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageOne); + _outbox.MarkDispatched(messageOne.Id); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageTwo); + _outbox.MarkDispatched(messageTwo.Id); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageThree); + + //act + _outbox.EntryCount.Should().Be(3); + + _bus.Archive(20000); + + //assert + _outbox.EntryCount.Should().Be(1); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().NotContain((new KeyValuePair(messageThree.Id, messageThree))); + + } + + [Fact] + public void When_Archiving_No_Messages_From_The_Outbox() + { + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageOne); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageTwo); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + _outbox.Add(messageThree); + + //act + _outbox.EntryCount.Should().Be(3); + + _bus.Archive(20000); + + //assert + _outbox.EntryCount.Should().Be(3); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().NotContain((new KeyValuePair(messageThree.Id, messageThree))); + } + + [Fact] + public void When_Archiving_An_Empty_The_Outbox() + { + _bus.Archive(20000); + + //assert + _outbox.EntryCount.Should().Be(0); + } +} diff --git a/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox_Async.cs b/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox_Async.cs new file mode 100644 index 0000000000..923b567ae0 --- /dev/null +++ b/tests/Paramore.Brighter.Core.Tests/Archiving/When_Archiving_Old_Messages_From_The_Outbox_Async.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Transactions; +using FluentAssertions; +using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; +using Polly; +using Polly.Registry; +using Xunit; + +namespace Paramore.Brighter.Core.Tests.Archiving; + +public class ServiceBusMessageStoreArchiverTestsAsync +{ + private readonly InMemoryOutbox _outbox; + private readonly InMemoryArchiveProvider _archiveProvider; + private readonly ExternalBusService _bus; + + public ServiceBusMessageStoreArchiverTestsAsync() + { + const string topic = "MyTopic"; + + var producer = new FakeMessageProducerWithPublishConfirmation{Publication = {Topic = new RoutingKey(topic), RequestType = typeof(MyCommand)}}; + + var messageMapperRegistry = new MessageMapperRegistry( + null, + new SimpleMessageMapperFactoryAsync((_) => new MyCommandMessageMapperAsync()) + ); + + var retryPolicy = Policy + .Handle() + .RetryAsync(); + + var circuitBreakerPolicy = Policy + .Handle() + .CircuitBreakerAsync(1, TimeSpan.FromMilliseconds(1)); + + var producerRegistry = new ProducerRegistry(new Dictionary + { + { topic, producer }, + }); + + var policyRegistry = new PolicyRegistry + { + { CommandProcessor.RETRYPOLICYASYNC, retryPolicy }, + { CommandProcessor.CIRCUITBREAKERASYNC, circuitBreakerPolicy } + }; + + var timeProvider = new FakeTimeProvider(); + _outbox = new InMemoryOutbox(timeProvider); + _archiveProvider = new InMemoryArchiveProvider(); + + _bus = new ExternalBusService( + producerRegistry, + policyRegistry, + messageMapperRegistry, + new EmptyMessageTransformerFactory(), + new EmptyMessageTransformerFactoryAsync(), + _outbox, + _archiveProvider + ); + + } + + [Fact] + public async Task When_Archiving_Old_Messages_From_The_Outbox() + { + //arrange + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageOne); + await _outbox.MarkDispatchedAsync(messageOne.Id); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageTwo); + await _outbox.MarkDispatchedAsync(messageTwo.Id); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageThree); + await _outbox.MarkDispatchedAsync(messageThree.Id); + + //act + _outbox.EntryCount.Should().Be(3); + + await _bus.ArchiveAsync(20000, new CancellationToken()); + + //assert + _outbox.EntryCount.Should().Be(0); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageThree.Id, messageThree)); + } + + [Fact] + public async Task When_Archiving_Some_Messages_From_The_Outbox() + { + //arrange + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageOne); + await _outbox.MarkDispatchedAsync(messageOne.Id); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageTwo); + await _outbox.MarkDispatchedAsync(messageTwo.Id); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageThree); + + //act + _outbox.EntryCount.Should().Be(3); + + await _bus.ArchiveAsync(20000, new CancellationToken()); + + //assert + _outbox.EntryCount.Should().Be(1); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().Contain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageThree.Id, messageThree)); + } + + [Fact] + public async Task When_Archiving_No_Messages_From_The_Outbox() + { + //arrange + var messageOne = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageOne); + + var messageTwo = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageTwo); + + var messageThree = new Message(new MessageHeader(Guid.NewGuid().ToString(), "MyTopic", MessageType.MT_COMMAND), new MessageBody("test content")); + await _outbox.AddAsync(messageThree); + + //act + _outbox.EntryCount.Should().Be(3); + + await _bus.ArchiveAsync(20000, new CancellationToken()); + + //assert + _outbox.EntryCount.Should().Be(3); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageOne.Id, messageOne)); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageTwo.Id, messageTwo)); + _archiveProvider.ArchivedMessages.Should().NotContain(new KeyValuePair(messageThree.Id, messageThree)); + } + + [Fact] + public async Task When_Archiving_An_Empty_Outbox() + { + //act + await _bus.ArchiveAsync(20000, new CancellationToken()); + + //assert + _outbox.EntryCount.Should().Be(0); + } +} diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor.cs index 4de671ecc5..2155c4a991 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Call { [Collection("CommandProcessor")] public class CommandProcessorCallTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs index 70bb12eaa5..2928c5c779 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_In_Mapper.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Call { [Collection("CommandProcessor")] public class CommandProcessorNoInMapperTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs index b3dd38d509..ed3dae0279 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Out_Mapper.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Call { [Collection("CommandProcessor")] public class CommandProcessorMissingOutMapperTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs index d1f63a23d3..409d424e1c 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Call/When_Calling_A_Server_Via_The_Command_Processor_With_No_Timeout.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Call { [Collection("CommandProcessor")] public class CommandProcessorCallTestsNoTimeout : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs index 8ad02bc284..f040480707 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Bulk_Clearing_The_PostBox_On_The_Command_Processor_Async.cs @@ -24,9 +24,7 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; -using System.Linq; using System.Text.Json; -using System.Threading; using System.Threading.Tasks; using System.Transactions; using FluentAssertions; @@ -35,7 +33,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Clear { [Trait("Fragile", "CI")] [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs index f990267723..efdd0a7c88 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor _Async.cs @@ -34,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Clear { [Collection("CommandProcessor")] public class CommandProcessorPostBoxClearAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor.cs index 16e3b5c3ae..f4a0d884f3 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Clearing_The_PostBox_On_The_Command_Processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Clearing_The_PostBox_On_The_Command_Processor.cs @@ -33,7 +33,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Clear { [Collection("CommandProcessor")] public class CommandProcessorPostBoxClearTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs index 4742cf85bb..88a89d7867 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor.cs @@ -34,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Clear { [Collection("CommandProcessor")] public class CommandProcessorPostBoxImplicitClearTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs index f850c378c2..a7a0b1089b 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Clear/When_Implicit_Clearing_The_PostBox_On_The_Command_Processor_Async.cs @@ -26,7 +26,6 @@ THE SOFTWARE. */ using System.Collections.Generic; using System.Linq; using System.Text.Json; -using System.Threading; using System.Threading.Tasks; using System.Transactions; using FluentAssertions; @@ -35,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Clear { [Collection("CommandProcessor")] public class CommandProcessorPostBoxImplicitClearAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_putting_a_variable_into_the_bag_should_be_accessible_in_the_handler.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Context/When_Putting_A_Variable_Into_The_Bag_Should_Be_Accessible_In_The_Handler.cs similarity index 96% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_putting_a_variable_into_the_bag_should_be_accessible_in_the_handler.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Context/When_Putting_A_Variable_Into_The_Bag_Should_Be_Accessible_In_The_Handler.cs index d55451e0e8..0dee7d4593 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_putting_a_variable_into_the_bag_should_be_accessible_in_the_handler.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Context/When_Putting_A_Variable_Into_The_Bag_Should_Be_Accessible_In_The_Handler.cs @@ -5,7 +5,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Context { [Collection("CommandProcessor")] public class ContextBagVisibilityTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store.cs similarity index 95% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store.cs index adbf0e9618..69d0ca3c8a 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store.cs @@ -2,17 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using System.Transactions; using FluentAssertions; using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Paramore.Brighter.Extensions.DependencyInjection; using Polly; using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Deposit { [Collection("CommandProcessor")] public class CommandProcessorDepositPostTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync.cs index 1486d64b8d..219ea15dce 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Deposit { [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs similarity index 99% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs index d7c3c7891a..7480465e5b 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_StoreAsync_Bulk.cs @@ -11,7 +11,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Deposit { [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs similarity index 99% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs index 769d4c8eb0..ae446ad3b4 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Deposit/When_Depositing_A_Message_In_The_Message_Store_Bulk.cs @@ -10,7 +10,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Deposit { [Collection("CommandProcessor")] public class CommandProcessorBulkDepositPostTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs index b8dbb175e7..ec1ad03df4 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_Of_An_Async_Pipeline.cs @@ -25,12 +25,12 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineBuilderAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_of_A_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_of_A_Pipeline.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_of_A_Pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_of_A_Pipeline.cs index e441845cb7..4e1144f738 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_A_Handler_Is_Part_of_A_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_A_Handler_Is_Part_of_A_Pipeline.cs @@ -30,7 +30,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineBuilderTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs index b5e730ecc3..a98a58a8ab 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_An_Exception_Is_Thrown_Terminate_The_Pipeline.cs @@ -24,14 +24,14 @@ THE SOFTWARE. */ using System; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_A_Command.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_A_Command.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_A_Command.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_A_Command.cs index 215935f8a0..07fb2cacab 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_A_Command.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_A_Command.cs @@ -28,7 +28,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineForCommandTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_An_Async_Command.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_An_Async_Command.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_An_Async_Command.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_An_Async_Command.cs index 1c30dc15f5..b84b5db2ad 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Handler_For_An_Async_Command.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Handler_For_An_Async_Command.cs @@ -29,7 +29,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineForCommandAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs index 6d024bc8c3..73e592004c 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_ForiegnAttribues.cs @@ -25,12 +25,12 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineForeignAttributesTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs index 4daa3737cf..bbe79cf7bc 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Allow_Pre_And_Post_Tasks.cs @@ -25,12 +25,12 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs similarity index 95% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs index bb8d612b18..0169684c5e 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors.cs @@ -4,7 +4,7 @@ using Paramore.Brighter.Core.Tests.TestHelpers; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { public class BuildPipelineFaults { diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Preserve_The_Order.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Preserve_The_Order.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Preserve_The_Order.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Preserve_The_Order.cs index aa7a8557ee..924e307ea6 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_Preserve_The_Order.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_Preserve_The_Order.cs @@ -25,12 +25,12 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineOrderingTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox.cs index eee21df544..bc9787794a 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox.cs @@ -1,14 +1,14 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; using Paramore.Brighter.Inbox.Handlers; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs index 82d97d6544..567e343719 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute.cs @@ -1,13 +1,13 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxNoInboxAttributeTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs index 95106d3557..761ee42082 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_NoInbox_Attribute_Async .cs @@ -1,13 +1,13 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxNoInboxAttributeAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs index 2a51ed322b..c2cab952a0 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox.cs @@ -1,16 +1,16 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Paramore.Brighter.Inbox; -using Paramore.Brighter.Inbox.Exceptions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; +using Paramore.Brighter.Inbox; +using Paramore.Brighter.Inbox.Exceptions; using Paramore.Brighter.Inbox.Handlers; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxWhenUseInboxTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs index 6342f8b36d..790147ee5a 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_And_Use_Inbox_Async.cs @@ -2,16 +2,16 @@ using System.Linq; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Paramore.Brighter.Inbox; -using Paramore.Brighter.Inbox.Exceptions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; +using Paramore.Brighter.Inbox; +using Paramore.Brighter.Inbox.Exceptions; using Paramore.Brighter.Inbox.Handlers; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxWhenUseInboxAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Async.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Async.cs index ba57c4c871..b6773892e3 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Async.cs @@ -2,14 +2,14 @@ using System.Collections.Generic; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; using Paramore.Brighter.Inbox.Handlers; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { //TODO: //Respects different global choices i.e. throw, what to capture, context diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs index 2c57019735..85d869887c 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Pipeline_With_Global_Inbox_Override_Context.cs @@ -1,14 +1,14 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; using Paramore.Brighter.Inbox.Handlers; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineGlobalInboxContextTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs index 164d11147e..3c5f50d7a8 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_A_Sync_Pipeline_That_Has_Async_Handlers.cs @@ -25,13 +25,13 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineMixedHandlersTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs similarity index 96% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs index 9c1dbe7e8a..3c3a1645dd 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_ForiegnAttribues.cs @@ -1,12 +1,12 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineForiegnAttributesAsyncTests :IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs similarity index 96% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs index a8d2cebcd9..7e45dfc9a5 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks.cs @@ -1,12 +1,12 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelinePreAndPostFiltersAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs similarity index 95% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs index 690907a654..53b3c8f238 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Failures_Should_Be_ConfigurationErrors.cs @@ -4,7 +4,7 @@ using Paramore.Brighter.Core.Tests.TestHelpers; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { public class BuildPipelineFaultsAsync { diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Preserve_The_Order.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Preserve_The_Order.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Preserve_The_Order.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Preserve_The_Order.cs index 17a20823c4..fbf4f2a3bc 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_Preserve_The_Order.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_Preserve_The_Order.cs @@ -25,12 +25,12 @@ THE SOFTWARE. */ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineOrderingAsyncTests: IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs similarity index 96% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs index 19487f2b40..6f4f05617b 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Building_An_Async_Pipeline_That_Has_Sync_Handlers.cs @@ -1,13 +1,13 @@ using System; using System.Linq; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineMixedHandlersAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Hander_That_Has_Dependencies.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Hander_That_Has_Dependencies.cs similarity index 96% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Hander_That_Has_Dependencies.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Hander_That_Has_Dependencies.cs index 5409948c34..a071408109 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Hander_That_Has_Dependencies.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Hander_That_Has_Dependencies.cs @@ -4,7 +4,7 @@ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineWithHandlerDependenciesTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Handler_For_A_Command.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Handler_For_A_Command.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Handler_For_A_Command.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Handler_For_A_Command.cs index 1396e55fb1..f3789a8b2c 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Finding_A_Handler_For_A_Command.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Finding_A_Handler_For_A_Command.cs @@ -28,7 +28,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineBuildForCommandTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs index 337fce2bd3..089d5e1513 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline.cs @@ -1,17 +1,17 @@ using System; using System.Collections.Generic; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Paramore.Brighter.Inbox; -using Polly; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; +using Paramore.Brighter.Inbox; using Paramore.Brighter.Inbox.Handlers; +using Polly; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class CommandProcessorBuildDefaultInboxPublishTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs index d7e43ae462..0eb1a70b14 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Publish_Pipeline_Async.cs @@ -2,16 +2,16 @@ using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; using Paramore.Brighter.Inbox.Handlers; +using Polly; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class CommandProcessorBuildDefaultInboxPublishAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs index 86cdda4e22..94441e6986 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline.cs @@ -1,16 +1,16 @@ using System; using FluentAssertions; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Time.Testing; using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; +using Paramore.Brighter.Extensions.DependencyInjection; using Paramore.Brighter.Inbox; +using Paramore.Brighter.Inbox.Handlers; using Polly; using Polly.Registry; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Time.Testing; -using Paramore.Brighter.Extensions.DependencyInjection; using Xunit; -using Paramore.Brighter.Inbox.Handlers; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class CommandProcessorBuildDefaultInboxSendTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs index 24abc5c8b5..eb26504a12 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_Inserting_A_Default_Inbox_Into_The_Send_Pipeline_Async.cs @@ -2,16 +2,16 @@ using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Time.Testing; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; -using Xunit; using Paramore.Brighter.Inbox.Handlers; +using Polly; +using Polly.Registry; +using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class CommandProcessorBuildDefaultInboxSendAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs index f53be422b0..e44d641460 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_There_Is_No_Sync_Or_Async_Handler_Factories.cs @@ -6,7 +6,7 @@ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors; +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline; [Collection("CommandProcessor")] public class CommandProcessorNoHandlerFactoriesTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_we_have_exercised_the_pipeline_cleanup_its_handlers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_We_Have_Exercised_The_Pipeline_Cleanup_Its_Handlers.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_we_have_exercised_the_pipeline_cleanup_its_handlers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_We_Have_Exercised_The_Pipeline_Cleanup_Its_Handlers.cs index 059bab76ff..fa681533b6 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_we_have_exercised_the_pipeline_cleanup_its_handlers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Pipeline/When_We_Have_Exercised_The_Pipeline_Cleanup_Its_Handlers.cs @@ -4,7 +4,7 @@ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Pipeline { [Collection("CommandProcessor")] public class PipelineCleanupTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs index f27089b2ed..dcf3a57f66 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry.cs @@ -24,7 +24,6 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; -using System.Text.Json; using System.Transactions; using FluentAssertions; using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; @@ -33,7 +32,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorNoMessageMapperTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs index 600c5b736f..69eaae18a3 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Mapper_Registry_Async.cs @@ -34,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorNoMessageMapperAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs index 84d3ba8a4b..c113ad987e 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Producer.cs @@ -23,7 +23,6 @@ THE SOFTWARE. */ #endregion using System; -using System.Collections.Generic; using System.Text.Json; using System.Transactions; using FluentAssertions; @@ -35,7 +34,7 @@ THE SOFTWARE. */ using Polly.Retry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorPostMissingMessageProducerTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs index 1e36148ca7..b9e1913a8e 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer.cs @@ -35,7 +35,7 @@ THE SOFTWARE. */ using Polly.Retry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorPostMissingMessageTransformerTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs index 80f67f728f..ccc0725865 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_And_There_Is_No_Message_Transformer_Async.cs @@ -35,7 +35,7 @@ THE SOFTWARE. */ using Polly.Retry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorPostMissingMessageTransformerTestsAsync : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor.cs index 9ac7e39208..ceaf4db2e6 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor.cs @@ -33,7 +33,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorPostCommandTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor_Async.cs index e913763cc8..e76cb99f69 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_A_Message_To_The_Command_Processor_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_A_Message_To_The_Command_Processor_Async.cs @@ -34,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorPostCommandAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs index 755cd5e56a..a02fbc09b6 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Fails_Limit_Total_Writes_To_OutBox_In_Window.cs @@ -32,7 +32,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class PostFailureLimitCommandTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender.cs index f96bf87cf1..3b572c1bbd 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender.cs @@ -33,7 +33,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class ControlBusSenderPostMessageTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender_Async.cs index 13c073c057..339bf7d99c 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_Via_A_Control_Bus_Sender_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_Via_A_Control_Bus_Sender_Async.cs @@ -35,7 +35,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Trait("Fragile", "CI")] [Collection("CommandProcessor")] diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_A_Default_Policy.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_A_Default_Policy.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_A_Default_Policy.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_A_Default_Policy.cs index ed890eb4b4..4c0f1290c6 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_A_Default_Policy.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_A_Default_Policy.cs @@ -31,7 +31,7 @@ THE SOFTWARE. */ using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class PostCommandTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store.cs index 826958c502..d9a3780847 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store.cs @@ -33,7 +33,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorWithInMemoryOutboxTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store_Async.cs index 79cca7e320..d6c9e558fd 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Posting_With_An_In_Memory_Message_Store_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Post/When_Posting_With_An_In_Memory_Message_Store_Async.cs @@ -34,7 +34,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Post { [Collection("CommandProcessor")] public class CommandProcessorWithInMemoryOutboxAscyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs index abef97e75c..57ff122d27 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_Publishing_To_Multiple_Subscribers_Should_Aggregate_Exceptions_Async.cs @@ -26,14 +26,14 @@ THE SOFTWARE. */ using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class PublishingToMultipleSubscribersAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_subscribers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_subscribers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers.cs index f0828852c9..b9e049916f 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_subscribers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers.cs @@ -25,14 +25,14 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorPublishMultipleMatchesTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Subscribers_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Subscribers_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers_Async.cs index 4b2e0ca7f7..b0c828c545 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Subscribers_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_Multiple_Subscribers_Async.cs @@ -26,14 +26,14 @@ THE SOFTWARE. */ using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorPublishMultipleMatchesAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Command_Handlers_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Command_Handlers_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Command_Handlers_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Command_Handlers_Async.cs index 7095038706..c0fb9b3d20 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Command_Handlers_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Command_Handlers_Async.cs @@ -25,14 +25,14 @@ THE SOFTWARE. */ using System; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorNoHandlersMatchAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_subscribers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_subscribers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers.cs index 19efe88d47..5919e1cdfe 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_subscribers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers.cs @@ -30,7 +30,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorNoMatchingSubcribersTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Subscribers_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers_Async.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Subscribers_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers_Async.cs index 8bd8090d97..e7eaccd978 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_No_Subscribers_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_There_Are_No_Subscribers_Async.cs @@ -31,7 +31,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorNoMatchingSubcribersAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_an_event_to_the_processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_an_event_to_the_processor.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_an_event_to_the_processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_an_event_to_the_processor.cs index bf96d2709c..414511fa6e 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_an_event_to_the_processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_an_event_to_the_processor.cs @@ -29,7 +29,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorPublishEventTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs index 542a207592..0a82c82c37 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_publishing_to_multiple_subscribers_should_aggregate_exceptions.cs @@ -25,14 +25,14 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class PublishingToMultipleSubscribersTests: IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_command_handlers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_there_are_no_command_handlers.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_command_handlers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_there_are_no_command_handlers.cs index 9884cfbd08..343f23ec12 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_command_handlers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Publish/When_there_are_no_command_handlers.cs @@ -24,14 +24,14 @@ THE SOFTWARE. */ using System; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Publish { [Collection("CommandProcessor")] public class CommandProcessorNoHandlersMatchTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Cancelling_An_Async_Command.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Cancelling_An_Async_Command.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Cancelling_An_Async_Command.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Cancelling_An_Async_Command.cs index 39bd6da541..d6d5845237 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Cancelling_An_Async_Command.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Cancelling_An_Async_Command.cs @@ -30,7 +30,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CancellingAsyncPipelineTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Sending_A_Command_To_The_Processor_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_Command_To_The_Processor_Async.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Sending_A_Command_To_The_Processor_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_Command_To_The_Processor_Async.cs index bfbebbef1b..c129d2f81f 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_Sending_A_Command_To_The_Processor_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_Command_To_The_Processor_Async.cs @@ -30,7 +30,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CommandProcessorSendAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_sending_a_command_to_the_processor.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_command_To_The_Processor.cs similarity index 97% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_sending_a_command_to_the_processor.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_command_To_The_Processor.cs index bd04d363d0..8893068c2f 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_sending_a_command_to_the_processor.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_Sending_A_command_To_The_Processor.cs @@ -28,7 +28,7 @@ THE SOFTWARE. */ using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CommandProcessorSendTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_possible_command_handlers.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_possible_command_handlers.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers.cs index a10b4e8c3e..6529b9b147 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_multiple_possible_command_handlers.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers.cs @@ -25,14 +25,14 @@ THE SOFTWARE. */ using System; using System.Collections.Generic; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CommandProcessorSendWithMultipleMatchesTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs index 9e8406a261..5cb58722b1 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_There_Are_Multiple_Possible_Command_Handlers_Async.cs @@ -26,14 +26,14 @@ THE SOFTWARE. */ using System.Collections.Generic; using System.Threading.Tasks; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Core.Tests.TestHelpers; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CommandProcessorSendWithMultipleMatchesAsyncTests : IDisposable diff --git a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs similarity index 98% rename from tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs rename to tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs index 2155f39932..3450962646 100644 --- a/tests/Paramore.Brighter.Core.Tests/CommandProcessors/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs +++ b/tests/Paramore.Brighter.Core.Tests/CommandProcessors/Send/When_there_are_no_failures_execute_all_the_steps_in_the_pipeline.cs @@ -24,13 +24,13 @@ THE SOFTWARE. */ using System; using FluentAssertions; -using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; -using Polly.Registry; using Microsoft.Extensions.DependencyInjection; +using Paramore.Brighter.Core.Tests.CommandProcessors.TestDoubles; using Paramore.Brighter.Extensions.DependencyInjection; +using Polly.Registry; using Xunit; -namespace Paramore.Brighter.Core.Tests.CommandProcessors +namespace Paramore.Brighter.Core.Tests.CommandProcessors.Send { [Collection("CommandProcessor")] public class CommandProcessorPipelineStepsTests : IDisposable