From 6a60344145a69f5c74b87f294ff3cbf11bce5f1a Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Wed, 12 Jun 2024 18:21:27 +0700 Subject: [PATCH 1/6] feat(bus): remove AMQP communication transport BREAKING CHANGE: The `SecTester.Bus` package, which was intended to provide support of communication via the AMQP transport is removed. This change simplifies the codebase by removing deprecated options and encourages the use of more modern and supported transport methods. closes #172 --- SecTester.sln | 18 +- .../Dispatchers/ConsumedMessage.cs | 9 - .../DefaultRmqConnectionManager.cs | 112 -- .../Dispatchers/DefaultRmqEventBusFactory.cs | 45 - .../Dispatchers/IRmqConnectionManager.cs | 18 - .../Dispatchers/IRmqEventBusFactory.cs | 6 - .../Dispatchers/PendingMessage.cs | 19 - src/SecTester.Bus/Dispatchers/RmqEventBus.cs | 341 ---- .../Dispatchers/RmqEventBusOptions.cs | 13 - .../EventHandlerNotFoundException.cs | 11 - .../NoSubscriptionFoundException.cs | 11 - .../Extensions/GenericTypeExtensions.cs | 38 - .../Extensions/ServiceCollectionExtensions.cs | 59 - .../Extensions/TaskExtensions.cs | 26 - src/SecTester.Bus/Internal/IsExternalInit.cs | 9 - .../Internal/SnakeCaseNamingPolicy.cs | 14 - src/SecTester.Bus/README.md | 257 --- src/SecTester.Bus/SecTester.Bus.csproj | 34 - src/SecTester.Bus/packages.lock.json | 302 ---- src/SecTester.Core/Bus/Event.cs | 11 - src/SecTester.Core/Bus/IEventBus.cs | 22 - src/SecTester.Core/Bus/IEventDispatcher.cs | 8 - src/SecTester.Core/Bus/IEventListener.cs | 11 - src/SecTester.Core/Configuration.cs | 4 - .../Api/CreateRepeaterRequest.cs | 4 +- .../Api/DeleteRepeaterRequest.cs | 2 +- .../Commands/HttpRequest.cs | 2 +- .../Dispatchers/HttpCommandDispatcher.cs | 6 +- .../HttpCommandDispatcherConfig.cs | 2 +- .../Dispatchers/MessageSerializer.cs | 8 +- .../Dispatchers/RateLimitedHandler.cs | 2 +- .../Exceptions/HttpStatusException.cs | 2 +- .../HttpResponseMessageExtensions.cs | 4 +- .../Extensions/ServiceCollectionExtensions.cs | 67 +- .../Internal/JsonHeadersConverter.cs} | 6 +- ...sonHttpMethodEnumerationStringConverter.cs | 2 +- .../Internal/JsonSnakeCaseNamingPolicy.cs | 14 + .../ExponentialBackoffIRetryStrategy.cs | 7 +- .../ExponentialBackoffOptions.cs | 2 +- .../SecTester.Repeater.csproj | 13 +- src/SecTester.Repeater/packages.lock.json | 131 +- src/SecTester.Reporter/packages.lock.json | 173 ++- src/SecTester.Runner/SecRunner.cs | 2 - src/SecTester.Runner/packages.lock.json | 49 +- src/SecTester.Scan/Commands/CreateScan.cs | 4 +- src/SecTester.Scan/Commands/DeleteScan.cs | 2 +- src/SecTester.Scan/Commands/GetScan.cs | 2 +- src/SecTester.Scan/Commands/ListIssues.cs | 2 +- src/SecTester.Scan/Commands/StopScan.cs | 2 +- src/SecTester.Scan/Commands/UploadHar.cs | 4 +- src/SecTester.Scan/SecTester.Scan.csproj | 3 +- src/SecTester.Scan/packages.lock.json | 163 +- .../DefaultRmqConnectionManagerTests.cs | 237 --- .../Dispatchers/RmqEventBusOptionsTests.cs | 61 - .../Dispatchers/RmqEventBusTests.cs | 471 ------ .../EventHandlerNotFoundExceptionTests.cs | 36 - .../NoSubscriptionFoundException.cs | 19 - .../Extensions/GenericTypeExtensionsTests.cs | 32 - .../ServiceCollectionExtensionsTests.cs | 79 - .../Extensions/TaskExtensionsTests.cs | 74 - .../Fixtures/ConcreteEvent.cs | 6 - .../Fixtures/ConcreteEvent2.cs | 7 - .../Fixtures/ConcreteEvent3.cs | 7 - .../Fixtures/ConcreteFirstHandler.cs | 9 - .../Fixtures/ConcreteSecondHandler.cs | 9 - .../Fixtures/ConcreteThirdHandler.cs | 9 - .../SecTester.Bus.Tests.csproj | 22 - test/SecTester.Bus.Tests/Usings.cs | 29 - test/SecTester.Bus.Tests/packages.lock.json | 1372 ----------------- test/SecTester.Core.Tests/Bus/EventTests.cs | 49 - .../Bus/MessageTypeAttributeTests.cs | 2 +- .../ConfigurationTests.cs | 24 +- .../Fixtures/TestEvent.cs | 6 - .../Fixtures/TestEvent2.cs | 4 - .../Fixtures/TestMessage2.cs | 17 + .../SecTester.Core.Tests.csproj | 1 - .../Utils/MessageUtilsTests.cs | 10 +- .../Dispatchers/HttpCommandDispatcherTests.cs | 4 +- .../Dispatchers/MessageSerializerTests.cs | 7 +- .../HttpResponseMessageExtensionsTests.cs | 10 +- .../ServiceCollectionExtensionsTests.cs | 67 + .../Fixtures/BazQux.cs | 2 +- .../Fixtures/ConcreteCommand.cs | 2 +- .../Fixtures/ConcreteCommand2.cs | 2 +- .../Fixtures/FooBar.cs | 2 +- .../Fixtures/FooBaz.cs | 2 +- .../Fixtures/FooEnum.cs | 2 +- .../Fixtures/IMockInterface.cs | 2 +- .../ExponentialBackoffRetryStrategyTests.cs | 7 +- .../SecTester.Repeater.Tests.csproj | 3 +- test/SecTester.Repeater.Tests/Usings.cs | 9 + .../packages.lock.json | 45 +- .../packages.lock.json | 128 +- .../SecTester.Runner.Tests/packages.lock.json | 52 +- .../ServiceCollectionExtensionsTests.cs | 6 +- .../SecTester.Scan.Tests.csproj | 2 - test/SecTester.Scan.Tests/Usings.cs | 4 +- test/SecTester.Scan.Tests/packages.lock.json | 139 +- 98 files changed, 798 insertions(+), 4369 deletions(-) delete mode 100644 src/SecTester.Bus/Dispatchers/ConsumedMessage.cs delete mode 100644 src/SecTester.Bus/Dispatchers/DefaultRmqConnectionManager.cs delete mode 100644 src/SecTester.Bus/Dispatchers/DefaultRmqEventBusFactory.cs delete mode 100644 src/SecTester.Bus/Dispatchers/IRmqConnectionManager.cs delete mode 100644 src/SecTester.Bus/Dispatchers/IRmqEventBusFactory.cs delete mode 100644 src/SecTester.Bus/Dispatchers/PendingMessage.cs delete mode 100644 src/SecTester.Bus/Dispatchers/RmqEventBus.cs delete mode 100644 src/SecTester.Bus/Dispatchers/RmqEventBusOptions.cs delete mode 100644 src/SecTester.Bus/Exceptions/EventHandlerNotFoundException.cs delete mode 100644 src/SecTester.Bus/Exceptions/NoSubscriptionFoundException.cs delete mode 100644 src/SecTester.Bus/Extensions/GenericTypeExtensions.cs delete mode 100644 src/SecTester.Bus/Extensions/ServiceCollectionExtensions.cs delete mode 100644 src/SecTester.Bus/Extensions/TaskExtensions.cs delete mode 100644 src/SecTester.Bus/Internal/IsExternalInit.cs delete mode 100644 src/SecTester.Bus/Internal/SnakeCaseNamingPolicy.cs delete mode 100644 src/SecTester.Bus/README.md delete mode 100644 src/SecTester.Bus/SecTester.Bus.csproj delete mode 100644 src/SecTester.Bus/packages.lock.json delete mode 100644 src/SecTester.Core/Bus/Event.cs delete mode 100644 src/SecTester.Core/Bus/IEventBus.cs delete mode 100644 src/SecTester.Core/Bus/IEventDispatcher.cs delete mode 100644 src/SecTester.Core/Bus/IEventListener.cs rename src/{SecTester.Bus => SecTester.Repeater}/Commands/HttpRequest.cs (94%) rename src/{SecTester.Bus => SecTester.Repeater}/Dispatchers/HttpCommandDispatcher.cs (97%) rename src/{SecTester.Bus => SecTester.Repeater}/Dispatchers/HttpCommandDispatcherConfig.cs (74%) rename src/{SecTester.Bus => SecTester.Repeater}/Dispatchers/MessageSerializer.cs (79%) rename src/{SecTester.Bus => SecTester.Repeater}/Dispatchers/RateLimitedHandler.cs (97%) rename src/{SecTester.Bus => SecTester.Repeater}/Exceptions/HttpStatusException.cs (89%) rename src/{SecTester.Bus => SecTester.Repeater}/Extensions/HttpResponseMessageExtensions.cs (95%) rename src/{SecTester.Bus/Internal/HeadersConverter.cs => SecTester.Repeater/Internal/JsonHeadersConverter.cs} (92%) rename src/{SecTester.Bus => SecTester.Repeater}/Internal/JsonHttpMethodEnumerationStringConverter.cs (98%) create mode 100644 src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs rename src/{SecTester.Bus => SecTester.Repeater}/RetryStrategies/ExponentialBackoffIRetryStrategy.cs (81%) rename src/{SecTester.Bus => SecTester.Repeater}/RetryStrategies/ExponentialBackoffOptions.cs (64%) delete mode 100644 test/SecTester.Bus.Tests/Dispatchers/DefaultRmqConnectionManagerTests.cs delete mode 100644 test/SecTester.Bus.Tests/Dispatchers/RmqEventBusOptionsTests.cs delete mode 100644 test/SecTester.Bus.Tests/Dispatchers/RmqEventBusTests.cs delete mode 100644 test/SecTester.Bus.Tests/Exceptions/EventHandlerNotFoundExceptionTests.cs delete mode 100644 test/SecTester.Bus.Tests/Exceptions/NoSubscriptionFoundException.cs delete mode 100644 test/SecTester.Bus.Tests/Extensions/GenericTypeExtensionsTests.cs delete mode 100644 test/SecTester.Bus.Tests/Extensions/ServiceCollectionExtensionsTests.cs delete mode 100644 test/SecTester.Bus.Tests/Extensions/TaskExtensionsTests.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteEvent.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteEvent2.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteEvent3.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteFirstHandler.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteSecondHandler.cs delete mode 100644 test/SecTester.Bus.Tests/Fixtures/ConcreteThirdHandler.cs delete mode 100644 test/SecTester.Bus.Tests/SecTester.Bus.Tests.csproj delete mode 100644 test/SecTester.Bus.Tests/Usings.cs delete mode 100644 test/SecTester.Bus.Tests/packages.lock.json delete mode 100644 test/SecTester.Core.Tests/Bus/EventTests.cs delete mode 100644 test/SecTester.Core.Tests/Fixtures/TestEvent.cs delete mode 100644 test/SecTester.Core.Tests/Fixtures/TestEvent2.cs create mode 100644 test/SecTester.Core.Tests/Fixtures/TestMessage2.cs rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Dispatchers/HttpCommandDispatcherTests.cs (98%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Dispatchers/MessageSerializerTests.cs (98%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Extensions/HttpResponseMessageExtensionsTests.cs (96%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/BazQux.cs (74%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/ConcreteCommand.cs (83%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/ConcreteCommand2.cs (83%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/FooBar.cs (74%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/FooBaz.cs (66%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/FooEnum.cs (73%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/Fixtures/IMockInterface.cs (61%) rename test/{SecTester.Bus.Tests => SecTester.Repeater.Tests}/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs (93%) diff --git a/SecTester.sln b/SecTester.sln index b8081e3..74902e6 100644 --- a/SecTester.sln +++ b/SecTester.sln @@ -16,10 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Core", "src\SecTe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Core.Tests", "test\SecTester.Core.Tests\SecTester.Core.Tests.csproj", "{5608AF78-4476-47F0-8CEB-FD9849E8778B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Bus", "src\SecTester.Bus\SecTester.Bus.csproj", "{B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Bus.Tests", "test\SecTester.Bus.Tests\SecTester.Bus.Tests.csproj", "{8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Scan", "src\SecTester.Scan\SecTester.Scan.csproj", "{A48670DA-9103-4AAB-8914-6B7FDCD8654E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecTester.Scan.Tests", "test\SecTester.Scan.Tests\SecTester.Scan.Tests.csproj", "{0B9D9422-FBB0-4B21-B3C1-9927DDEDA702}" @@ -51,14 +47,6 @@ Global {5608AF78-4476-47F0-8CEB-FD9849E8778B}.Debug|Any CPU.Build.0 = Debug|Any CPU {5608AF78-4476-47F0-8CEB-FD9849E8778B}.Release|Any CPU.ActiveCfg = Release|Any CPU {5608AF78-4476-47F0-8CEB-FD9849E8778B}.Release|Any CPU.Build.0 = Release|Any CPU - {B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171}.Release|Any CPU.Build.0 = Release|Any CPU - {8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A}.Release|Any CPU.Build.0 = Release|Any CPU {A48670DA-9103-4AAB-8914-6B7FDCD8654E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A48670DA-9103-4AAB-8914-6B7FDCD8654E}.Debug|Any CPU.Build.0 = Debug|Any CPU {A48670DA-9103-4AAB-8914-6B7FDCD8654E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -94,12 +82,10 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {F5E1A845-BDCF-46D0-A8FE-CE47D41D35F7} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} - {B4AC0D7B-32DB-40B6-8F5D-E7CDC4D0A171} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {A48670DA-9103-4AAB-8914-6B7FDCD8654E} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {64E65289-A36D-46C6-9410-6B2040A51E8A} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} - {5608AF78-4476-47F0-8CEB-FD9849E8778B} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} - {8C0DEB9F-80F1-49D2-B5EE-8DA8A9BFF40A} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} - {0B9D9422-FBB0-4B21-B3C1-9927DDEDA702} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} + {5608AF78-4476-47F0-8CEB-FD9849E8778B} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} + {0B9D9422-FBB0-4B21-B3C1-9927DDEDA702} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} {853E5140-4448-41EA-8F2B-9C9FF2B5491E} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} {368F1410-F710-4678-8376-7FC356CFD338} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {5FC5E230-64F6-45F1-8661-1FF856FA6BC6} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} diff --git a/src/SecTester.Bus/Dispatchers/ConsumedMessage.cs b/src/SecTester.Bus/Dispatchers/ConsumedMessage.cs deleted file mode 100644 index 5228e9b..0000000 --- a/src/SecTester.Bus/Dispatchers/ConsumedMessage.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SecTester.Bus.Dispatchers; - -internal sealed record ConsumedMessage -{ - public string? CorrelationId { get; init; } - public string? Name { get; init; } - public string? Payload { get; init; } - public string? ReplyTo { get; init; } -} diff --git a/src/SecTester.Bus/Dispatchers/DefaultRmqConnectionManager.cs b/src/SecTester.Bus/Dispatchers/DefaultRmqConnectionManager.cs deleted file mode 100644 index 35f5b17..0000000 --- a/src/SecTester.Bus/Dispatchers/DefaultRmqConnectionManager.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using RabbitMQ.Client; -using RabbitMQ.Client.Events; -using SecTester.Core.Bus; - -namespace SecTester.Bus.Dispatchers; - -public class DefaultRmqConnectionManager : IRmqConnectionManager -{ - private readonly IConnectionFactory _connectionFactory; - private readonly ILogger _logger; - private readonly IRetryStrategy _retryStrategy; - private readonly object _sync = new(); - private IConnection? _connection; - - public DefaultRmqConnectionManager(IConnectionFactory connectionFactory, ILogger logger, IRetryStrategy retryStrategy) - { - _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - _retryStrategy = retryStrategy ?? throw new ArgumentNullException(nameof(retryStrategy)); - } - - public bool IsConnected => _connection is { IsOpen: true }; - - public void Dispose() - { - if (!IsConnected) - { - return; - } - - _connection.ConnectionShutdown -= ConnectionShutdown; - _connection.CallbackException -= CallbackException; - _connection.ConnectionBlocked -= ConnectionBlocked; - _connection.Close(); - _connection.Dispose(); - - GC.SuppressFinalize(this); - } - - public void TryConnect() - { - if (!IsConnected) - { - Connect(); - } - } - - public AsyncEventingBasicConsumer CreateConsumer(IModel channel) - { - ThrowIfNotConnected(); - - return new AsyncEventingBasicConsumer(channel); - } - - public void Connect() - { - lock (_sync) - { - var task = _retryStrategy.Acquire(() => - Task.Run(() => _connectionFactory.CreateConnection())).ConfigureAwait(false); - - _connection = task.GetAwaiter().GetResult(); - - if (!IsConnected) - { - return; - } - - _connection.ConnectionShutdown += ConnectionShutdown; - _connection.CallbackException += CallbackException; - _connection.ConnectionBlocked += ConnectionBlocked; - _logger.LogDebug("Event bus connected to {Hostname}", _connection.Endpoint.HostName); - } - } - - public IModel CreateChannel() - { - ThrowIfNotConnected(); - - return _connection!.CreateModel(); - } - - private void ThrowIfNotConnected() - { - if (!IsConnected) - { - throw new InvalidOperationException( - "Please make sure that client established a connection with host."); - } - } - - private void ConnectionBlocked(object sender, ConnectionBlockedEventArgs args) - { - _logger.LogWarning("A Event Bus connection blocked. Trying to re-connect."); - Connect(); - } - - private void ConnectionShutdown(object sender, ShutdownEventArgs args) - { - _logger.LogWarning("A Event Bus connection shutdown. Trying to re-connect."); - Connect(); - } - - private void CallbackException(object sender, CallbackExceptionEventArgs args) - { - _logger.LogWarning("A Event Bus connection throw exception. Trying to re-connect."); - Connect(); - } -} diff --git a/src/SecTester.Bus/Dispatchers/DefaultRmqEventBusFactory.cs b/src/SecTester.Bus/Dispatchers/DefaultRmqEventBusFactory.cs deleted file mode 100644 index 8cf53c0..0000000 --- a/src/SecTester.Bus/Dispatchers/DefaultRmqEventBusFactory.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using RabbitMQ.Client; -using SecTester.Core.Bus; - -namespace SecTester.Bus.Dispatchers; - -[ExcludeFromCodeCoverage] -public class DefaultRmqEventBusFactory : IRmqEventBusFactory -{ - private readonly IRetryStrategy _retryStrategy; - private readonly IServiceScopeFactory _serviceScopeFactory; - private readonly ILoggerFactory _loggerFactory; - - public DefaultRmqEventBusFactory(IServiceScopeFactory serviceScopeFactory, IRetryStrategy retryStrategy, - ILoggerFactory loggerFactory) - { - _serviceScopeFactory = serviceScopeFactory ?? throw new ArgumentNullException(nameof(serviceScopeFactory)); - _retryStrategy = retryStrategy ?? throw new ArgumentNullException(nameof(retryStrategy)); - _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); - } - - public RmqEventBus CreateEventBus(RmqEventBusOptions options) - { - var connectionManager = CreateConnectionManager(options); - return new RmqEventBus(options, connectionManager, _loggerFactory.CreateLogger(), _serviceScopeFactory); - } - - protected virtual IRmqConnectionManager CreateConnectionManager(RmqEventBusOptions options) - { - var factory = new ConnectionFactory - { - Uri = new Uri(options.Url), - RequestedHeartbeat = options.HeartbeatInterval, - RequestedConnectionTimeout = options.ConnectTimeout, - DispatchConsumersAsync = true, - Password = options.Password, - UserName = options.Username - }; - - return new DefaultRmqConnectionManager(factory, _loggerFactory.CreateLogger(), _retryStrategy); - } -} diff --git a/src/SecTester.Bus/Dispatchers/IRmqConnectionManager.cs b/src/SecTester.Bus/Dispatchers/IRmqConnectionManager.cs deleted file mode 100644 index c7d670d..0000000 --- a/src/SecTester.Bus/Dispatchers/IRmqConnectionManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using RabbitMQ.Client; -using RabbitMQ.Client.Events; - -namespace SecTester.Bus.Dispatchers; - -public interface IRmqConnectionManager : IDisposable -{ - bool IsConnected { get; } - - void Connect(); - - void TryConnect(); - - IModel CreateChannel(); - - AsyncEventingBasicConsumer CreateConsumer(IModel channel); -} diff --git a/src/SecTester.Bus/Dispatchers/IRmqEventBusFactory.cs b/src/SecTester.Bus/Dispatchers/IRmqEventBusFactory.cs deleted file mode 100644 index 665aab5..0000000 --- a/src/SecTester.Bus/Dispatchers/IRmqEventBusFactory.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SecTester.Bus.Dispatchers; - -public interface IRmqEventBusFactory -{ - RmqEventBus CreateEventBus(RmqEventBusOptions options); -} diff --git a/src/SecTester.Bus/Dispatchers/PendingMessage.cs b/src/SecTester.Bus/Dispatchers/PendingMessage.cs deleted file mode 100644 index e830473..0000000 --- a/src/SecTester.Bus/Dispatchers/PendingMessage.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Text; - -namespace SecTester.Bus.Dispatchers; - -internal sealed record MessageParams -{ - public T? Payload { get; init; } - public string? RoutingKey { get; init; } - public string? Exchange { get; init; } - public string? Type { get; init; } - public string? CorrelationId { get; init; } - public string? ReplyTo { get; init; } - public DateTime? CreatedAt { get; init; } - - public string ToJson() => Payload is not null ? MessageSerializer.Serialize(Payload) : ""; - public byte[] ToBytes() => Encoding.UTF8.GetBytes(ToJson()); -} - diff --git a/src/SecTester.Bus/Dispatchers/RmqEventBus.cs b/src/SecTester.Bus/Dispatchers/RmqEventBus.cs deleted file mode 100644 index 6d1c2ff..0000000 --- a/src/SecTester.Bus/Dispatchers/RmqEventBus.cs +++ /dev/null @@ -1,341 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using RabbitMQ.Client; -using RabbitMQ.Client.Events; -using SecTester.Bus.Exceptions; -using SecTester.Bus.Extensions; -using SecTester.Core; -using SecTester.Core.Bus; -using SecTester.Core.Utils; - -namespace SecTester.Bus.Dispatchers; - -public class RmqEventBus : IEventBus -{ - private const string ReplyQueueName = "amq.rabbitmq.reply-to"; - - private readonly IRmqConnectionManager _connectionManager; - private readonly List _eventTypes = new(); - private readonly Dictionary> _handlers = new(); - private readonly ILogger _logger; - private readonly RmqEventBusOptions _options; - private readonly ConcurrentDictionary> _pendingMessages = new(); - private readonly IServiceScopeFactory _scopeFactory; - private IModel _channel; - - public RmqEventBus(RmqEventBusOptions options, IRmqConnectionManager connectionManager, ILogger logger, - IServiceScopeFactory scopeFactory) - { - _options = options ?? throw new ArgumentNullException(nameof(options)); - _connectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager)); - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory)); - _channel = CreateConsumerChannel(); - } - - public Task Publish(TEvent message) where TEvent : Event - { - _connectionManager.TryConnect(); - - SendMessage(new MessageParams - { - Payload = message, - Type = message.Type, - RoutingKey = message.Type, - Exchange = _options.Exchange, - CorrelationId = message.CorrelationId, - CreatedAt = message.CreatedAt - }); - - return Task.CompletedTask; - } - - public async Task Execute(Command message) - { - var tcs = new TaskCompletionSource(); - _pendingMessages[message.CorrelationId] = tcs; - var ct = new CancellationTokenSource(message.Ttl); - using var _ = ct.Token.Register(() => tcs.TrySetCanceled(), false); - - SendMessage(_channel, new MessageParams - { - Payload = message, - Type = message.Type, - ReplyTo = ReplyQueueName, - RoutingKey = _options.AppQueue, - CorrelationId = message.CorrelationId, - CreatedAt = message.CreatedAt - }); - - if (!message.ExpectReply) - { - return default; - } - - var result = await tcs.Task.ConfigureAwait(false); - - return MessageSerializer.Deserialize(result); - } - - public void Register() where THandler : IEventListener where TEvent : Event - { - var eventName = MessageUtils.GetMessageType(); - var handlerType = typeof(THandler); - var eventType = typeof(TEvent); - - if (!_handlers.ContainsKey(eventName)) - { - _eventTypes.Add(eventType); - _handlers.Add(eventName, new List()); - BindQueue(eventName); - } - - _handlers[eventName].Add(handlerType); - } - - public void Unregister() where THandler : IEventListener where TEvent : Event - { - var eventName = MessageUtils.GetMessageType(); - var handlerType = typeof(THandler); - var eventType = typeof(TEvent); - - if (!_handlers.ContainsKey(eventName)) - { - throw new NoSubscriptionFoundException(eventName); - } - - _handlers[eventName].Remove(handlerType); - - if (_handlers[eventName] is { Count: 0 }) - { - _eventTypes.Remove(eventType); - _handlers.Remove(eventName); - UnBindQueue(eventName); - } - } - - public void Register() where THandler : IEventListener where TEvent : Event => - Register(); - - public void Unregister() where THandler : IEventListener where TEvent : Event => - Unregister(); - - public void Dispose() - { - _connectionManager.Dispose(); - GC.SuppressFinalize(this); - } - - private Task ReplyReceiverHandler(BasicDeliverEventArgs args) - { - var data = Encoding.UTF8.GetString(args.Body.ToArray()); - - if (!string.IsNullOrEmpty(args.BasicProperties.CorrelationId)) - { - _logger.LogDebug( - "Received a reply ({CorrelationId}) with following payload: {Payload}", - args.BasicProperties.CorrelationId, - data - ); - - _pendingMessages.TryRemove(args.BasicProperties.CorrelationId!, out var tcs); - tcs?.SetResult(data); - } - - return Task.CompletedTask; - } - - private IModel CreateConsumerChannel() - { - _connectionManager.TryConnect(); - - var channel = _connectionManager.CreateChannel(); - channel.CallbackException += (_, _) => - { - _channel.Dispose(); - _channel = CreateConsumerChannel(); - }; - - BindQueueToExchange(channel); - StartBasicConsume(channel); - StartReplyQueueConsume(channel); - - return channel; - } - - private void StartBasicConsume(IModel channel) - { - var consumer = _connectionManager.CreateConsumer(channel); - consumer.Received += ReceiverHandler; - channel.BasicConsume(_options.ClientQueue, true, consumer); - } - - private void StartReplyQueueConsume(IModel channel) - { - var consumer = _connectionManager.CreateConsumer(channel); - consumer.Received += (_, args) => ReplyReceiverHandler(args); - channel.BasicConsume(ReplyQueueName, true, consumer); - } - - private void BindQueueToExchange(IModel channel) - { - channel.ExchangeDeclare(_options.Exchange, "direct", true); - channel.QueueDeclare(_options.ClientQueue, exclusive: false, autoDelete: true, durable: true); - channel.BasicQos(0, _options.PrefetchCount, false); - } - - private async Task ReceiverHandler(object sender, BasicDeliverEventArgs args) - { - if (args.Redelivered) - { - return; - } - - var name = string.IsNullOrEmpty(args.BasicProperties.Type) ? args.RoutingKey : args.BasicProperties.Type; - var handlers = GetHandlers(name); - var body = Encoding.UTF8.GetString(args.Body.ToArray()); - var consumedMessage = new ConsumedMessage - { - Name = name, - Payload = body, - ReplyTo = args.BasicProperties.ReplyTo, - CorrelationId = args.BasicProperties.CorrelationId - }; - - _logger.LogDebug( - "Received a event ({Name}) with following payload: {Body}", consumedMessage.Name, - body - ); - - foreach (var handler in handlers) - { - await HandleEvent(handler, consumedMessage).ConfigureAwait(false); - } - } - - private List GetHandlers(string eventName) - { - if (!_handlers.ContainsKey(eventName)) - { - throw new NoSubscriptionFoundException(eventName); - } - - if (_handlers[eventName] is null or { Count: 0 }) - { - throw new EventHandlerNotFoundException(eventName); - } - - return _handlers[eventName]; - } - - private async Task HandleEvent(Type eventHandler, ConsumedMessage consumedMessage) - { - try - { - var scope = _scopeFactory.CreateAsyncScope(); - await using var _ = scope.ConfigureAwait(false); - var instance = scope.ServiceProvider.GetService(eventHandler); - var eventType = GetEventType(consumedMessage.Name!); - - if (instance == null || eventType == null) - { - return; - } - - var concreteType = eventHandler.GetConcreteEventListenerType(); - var payload = MessageSerializer.Deserialize(consumedMessage.Payload!, eventType); - var task = (Task)concreteType.InvokeMember(nameof(IEventListener.Handle), BindingFlags.InvokeMethod, null, instance, new[] - { - payload - }, CultureInfo.InvariantCulture); - var response = await task.Cast().ConfigureAwait(false); - - if (response != null && !string.IsNullOrEmpty(consumedMessage.ReplyTo)) - { - SendReplyOnEvent(consumedMessage, response); - } - } - catch (Exception err) - { - _logger.LogDebug(err, "Error while processing a message ({CorrelationId}) due to error occurred. Event: {Payload}", - consumedMessage.CorrelationId, consumedMessage.Payload); - } - } - - private void SendReplyOnEvent(ConsumedMessage consumedMessage, T response) - { - _logger.LogDebug( - "Sending a reply ({Event}) back with following payload: {Json}", - consumedMessage.Name, - response - ); - - SendMessage(new MessageParams - { - Payload = response, - RoutingKey = consumedMessage.ReplyTo!, - CorrelationId = consumedMessage.CorrelationId - }); - } - - private static IBasicProperties CreateMessageProperties(IModel channel, DateTime? createdAt = default) - { - var properties = channel.CreateBasicProperties(); - var timestamp = new DateTimeOffset(createdAt ?? DateTime.UtcNow); - properties.Timestamp = new AmqpTimestamp(timestamp.ToUnixTimeMilliseconds()); - properties.Persistent = true; - properties.ContentType = "application/json"; - return properties; - } - - private void SendMessage(IModel channel, MessageParams messageParams) - { - var properties = CreateMessageProperties(channel, messageParams.CreatedAt); - properties.CorrelationId = messageParams.CorrelationId; - properties.Type = messageParams.Type; - properties.ReplyTo = messageParams.ReplyTo; - - _logger.LogDebug("Send a message with following parameters: {Params}", messageParams); - - channel.BasicPublish(messageParams.Exchange ?? "", - messageParams.RoutingKey, - true, - properties, - messageParams.ToBytes()); - } - - private void SendMessage(MessageParams messageParams) - { - using var channel = _connectionManager.CreateChannel(); - SendMessage(channel, messageParams); - } - - private void BindQueue(string eventName) - { - _connectionManager.TryConnect(); - using var channel = _connectionManager.CreateChannel(); - channel.QueueBind(_options.ClientQueue, - _options.Exchange, - eventName); - } - - private void UnBindQueue(string eventName) - { - _connectionManager.TryConnect(); - using var channel = _connectionManager.CreateChannel(); - channel.QueueUnbind(_options.ClientQueue, - _options.Exchange, - eventName); - } - - private Type? GetEventType(string eventName) => _eventTypes.SingleOrDefault(x => MessageUtils.GetMessageType(x) == eventName); -} diff --git a/src/SecTester.Bus/Dispatchers/RmqEventBusOptions.cs b/src/SecTester.Bus/Dispatchers/RmqEventBusOptions.cs deleted file mode 100644 index eeffb94..0000000 --- a/src/SecTester.Bus/Dispatchers/RmqEventBusOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace SecTester.Bus.Dispatchers; - -public sealed record RmqEventBusOptions(string Url, string AppQueue, string Exchange, string ClientQueue) -{ - public TimeSpan ConnectTimeout { get; init; } = TimeSpan.FromSeconds(30); - public TimeSpan HeartbeatInterval { get; init; } = TimeSpan.FromSeconds(30); - public ushort PrefetchCount { get; init; } = 1; - public TimeSpan ReconnectTime { get; init; } = TimeSpan.FromSeconds(30); - public string? Password { get; init; } - public string? Username { get; init; } -} diff --git a/src/SecTester.Bus/Exceptions/EventHandlerNotFoundException.cs b/src/SecTester.Bus/Exceptions/EventHandlerNotFoundException.cs deleted file mode 100644 index 257f6db..0000000 --- a/src/SecTester.Bus/Exceptions/EventHandlerNotFoundException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace SecTester.Bus.Exceptions; - -public class EventHandlerNotFoundException : Exception -{ - public EventHandlerNotFoundException(params string[] eventNames) : base( - $"Event handler not found. Please register a handler for the following events: {string.Join(", ", eventNames)}") - { - } -} diff --git a/src/SecTester.Bus/Exceptions/NoSubscriptionFoundException.cs b/src/SecTester.Bus/Exceptions/NoSubscriptionFoundException.cs deleted file mode 100644 index 41e10ec..0000000 --- a/src/SecTester.Bus/Exceptions/NoSubscriptionFoundException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace SecTester.Bus.Exceptions; - -public class NoSubscriptionFoundException : Exception -{ - public NoSubscriptionFoundException(string eventName) : base( - $"No subscriptions found. Please register a handler for the {eventName} event in the event bus.") - { - } -} diff --git a/src/SecTester.Bus/Extensions/GenericTypeExtensions.cs b/src/SecTester.Bus/Extensions/GenericTypeExtensions.cs deleted file mode 100644 index e95633e..0000000 --- a/src/SecTester.Bus/Extensions/GenericTypeExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Linq; -using SecTester.Core.Bus; - -namespace SecTester.Bus.Extensions; - -internal static class GenericTypeExtensions -{ - public static Type GetConcreteEventListenerType(this Type type) - { - var (input, output) = GetEventListenerGenericTypes(type); - var interfaceType = typeof(IEventListener<,>); - - return interfaceType.MakeGenericType(input, output); - } - - private static Tuple GetEventListenerGenericTypes(this Type type) - { - var genericTypes = type.GetInterfaces() - .Where(IsEventListenerType) - .SelectMany(it => it.GetGenericArguments()) - .ToArray(); - - return new Tuple(genericTypes.First(), genericTypes.Last()); - } - - private static bool IsEventListenerType(Type it) - { - var interfaceType = GetEventListenerType(); - - return it.IsGenericType && it.GetGenericTypeDefinition() == interfaceType; - } - - private static Type GetEventListenerType() - { - return typeof(IEventListener<,>); - } -} diff --git a/src/SecTester.Bus/Extensions/ServiceCollectionExtensions.cs b/src/SecTester.Bus/Extensions/ServiceCollectionExtensions.cs deleted file mode 100644 index 595cb02..0000000 --- a/src/SecTester.Bus/Extensions/ServiceCollectionExtensions.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading.RateLimiting; -using Microsoft.Extensions.DependencyInjection; -using SecTester.Bus.Dispatchers; -using SecTester.Bus.RetryStrategies; -using SecTester.Core; -using SecTester.Core.Bus; - -namespace SecTester.Bus.Extensions; - -public static class ServiceCollectionExtensions -{ - public static IServiceCollection AddSecTesterBus(this IServiceCollection collection) => - collection - .AddHttpCommandDispatcher() - .AddSingleton(new ExponentialBackoffOptions()) - .AddSingleton() - .AddSingleton(); - - private static IServiceCollection AddHttpCommandDispatcher(this IServiceCollection collection) => - collection - .AddScoped(sp => - { - var config = sp.GetRequiredService(); - return new HttpCommandDispatcherConfig(config.Api, config.Credentials!.Token, TimeSpan.FromSeconds(10)); - }) - .AddScoped() - .AddScoped(sp => sp.GetRequiredService()) - .AddHttpClientForHttpCommandDispatcher(); - - private static IServiceCollection AddHttpClientForHttpCommandDispatcher(this IServiceCollection collection) - { - collection - .AddHttpClient(nameof(HttpCommandDispatcher), ConfigureHttpClient) - .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandler); - - return collection; - } - - private static HttpMessageHandler CreateHttpMessageHandler() - { - var options = new FixedWindowRateLimiterOptions - { - Window = TimeSpan.FromSeconds(60), - PermitLimit = 10, - QueueLimit = 5 - }; - var rateLimiter = new FixedWindowRateLimiter(options); - - return new RateLimitedHandler(rateLimiter); - } - - private static void ConfigureHttpClient(IServiceProvider sp, HttpClient client) - { - var config = sp.GetRequiredService(); - client.Timeout = (TimeSpan)config.Timeout!; - } -} diff --git a/src/SecTester.Bus/Extensions/TaskExtensions.cs b/src/SecTester.Bus/Extensions/TaskExtensions.cs deleted file mode 100644 index c334ac5..0000000 --- a/src/SecTester.Bus/Extensions/TaskExtensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Threading.Tasks; - -namespace SecTester.Bus.Extensions; - -internal static class TaskExtensions -{ - public static async Task Cast(this Task task) - { - if (task is null) - { - throw new ArgumentNullException(nameof(task)); - } - - if (!task.GetType().IsGenericType) - { - throw new ArgumentException("An argument of type 'Task' was expected"); - } - - await task.ConfigureAwait(false); - - var result = task.GetType().GetProperty(nameof(Task.Result))?.GetValue(task); - - return (T?)result; - } -} diff --git a/src/SecTester.Bus/Internal/IsExternalInit.cs b/src/SecTester.Bus/Internal/IsExternalInit.cs deleted file mode 100644 index 816eddd..0000000 --- a/src/SecTester.Bus/Internal/IsExternalInit.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; - -namespace System.Runtime.CompilerServices -{ - [ExcludeFromCodeCoverage] - [EditorBrowsable(EditorBrowsableState.Never)] - internal static class IsExternalInit { } -} diff --git a/src/SecTester.Bus/Internal/SnakeCaseNamingPolicy.cs b/src/SecTester.Bus/Internal/SnakeCaseNamingPolicy.cs deleted file mode 100644 index 87d5fb1..0000000 --- a/src/SecTester.Bus/Internal/SnakeCaseNamingPolicy.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json; -using SecTester.Core.Utils; - -namespace SecTester.Bus.Internal; - -internal class SnakeCaseNamingPolicy : JsonNamingPolicy -{ - public static JsonNamingPolicy Instance { get; } = new SnakeCaseNamingPolicy(); - - public override string ConvertName(string name) - { - return name.ToSnakeCase(); - } -} diff --git a/src/SecTester.Bus/README.md b/src/SecTester.Bus/README.md deleted file mode 100644 index e527f87..0000000 --- a/src/SecTester.Bus/README.md +++ /dev/null @@ -1,257 +0,0 @@ -# SecTester.Bus - -[![Maintainability](https://api.codeclimate.com/v1/badges/c92a6cb490b75c55133a/maintainability)](https://codeclimate.com/github/NeuraLegion/sectester-net/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/c92a6cb490b75c55133a/test_coverage)](https://codeclimate.com/github/NeuraLegion/sectester-net/test_coverage) -![Build Status](https://github.com/NeuraLegion/sectester-net/actions/workflows/coverage.yml/badge.svg?branch=master&event=push) -![Nuget Downloads](https://img.shields.io/nuget/dt/SecTester.Bus) - -The package includes a simplified implementation of the `EventBus`, one based on `RabbitMQ`, to establish synchronous -and asynchronous communication between services and agents. - -## Setup - -```bash -$ dotnet add package SecTester.Bus -``` - -## Usage - -### Overview - -To use the RabbitMQ Event Bus, pass the following options object to the constructor method: - -```csharp -const string repeaterId = "your Repeater ID"; -var serviceProvider = new ServiceCollection() - .AddSecTesterConfig("app.brightsec.com") - .AddSecTesterBus(repeaterId) - .BuildServiceProvider(); - -var bus = serviceProvider.GetService(); -``` - -The options are specific to the chosen transporter, the package distributes the `RabbitMQ` implementation by default. -The implementation exposes the properties described below: - -| Option | Description | -| :------------------ | ----------------------------------------------------------------------- | -| `Url` | EventBus address. | -| `Exchange` | Exchange name which routes a message to a particular queue. | -| `ClientQueue` | Queue name which your bus will listen to. | -| `AppQueue` | Queue name which application will listen to. | -| `PrefetchCount` | Sets the prefetch count for the channel. By default, `1` | -| `ConnectTimeout` | Time to wait for initial connect. By default, `30` seconds | -| `ReconnectTime` | The time to wait before trying to reconnect. By default, `20` seconds. | -| `HeartbeatInterval` | The interval, in seconds, to send heartbeats. By default, `30` seconds. | -| `Username` | The `username` to perform authentication. | -| `Password` | The `password` to perform authentication. | - -In case of unrecoverable or operational errors, you will get an exception while initial connecting. - -### Subscribing to events - -To subscribe an event handler to the particular event, you should register the handler in the `EventBus` as follows: - -```csharp -public record Issue -{ - public string Name; - public string Details; - public string Type; - public string? cvss; - public string? cwe; -} - -public record IssueDetected(Issue Payload) : Event -{ - public Issue Payload = Payload; -} - -public class IssueDetectedHandler: IEventListener -{ - public Task Handle(IssueDetected @event) - { - // implementation - } -} - -bus.Register(); -``` - -> ⚡ Make sure that you register the corresponding provider in the IoC. Otherwise, you -> get an error while receiving an event in the `EventBus`. - -You can also override a event name using the `MessageType` attribute as follows: - -```csharp -[MessageType(name: "issue-detected")] -public record IssueDetected(Issue Payload) : Event -{ - public Issue Payload = Payload; -} -``` - -Now the `IssueDetectedHandler` event handler listens for the `IssueDetected` event. As soon as the `IssueDetected` event -appears, the `EventBus` will call the `Handle()` method with the payload passed from the application. - -To remove subscription, and removes the event handler, you have to call the `unregister()` method: - -```csharp -await bus.Unregister(); -``` - -#### Publishing events through the event bus - -The `IEventBus` exposes a `Publish()` method. This method publishes an event to the message broker. - -```csharp -public record StatusChanged(string Status): Event -{ - public string Status = Status; -} - -var event = new StatusChanged("connected"); - -await bus.Publish(event); -``` - -The `Publish()` method takes just a single argument, an instance of the derived class of the `Event`. - -> ⚡ The class name should match one defined event in the application. Otherwise, you should override it by passing the -> expected name via the constructor or using the `MessageType` attribute. - -For more information, please see `SecTester.Core`. - -#### Executing RPC methods - -The `IEventBus` exposes a `Execute()` method. This method is intended to perform a command to the application and returns -an `Task` with its response. - -```csharp -public record Version(string Value) -{ - public string Value = Value; -} - -public record LastVersion(Version Value) -{ - public Version Value = Value; -} - -public record CheckVersion(Version Version): Command -{ - public Version Version = Version; -} - -var command = new CheckVersion(new Version("1.1.1")); -var response = await bus.Execute(command); -``` - -This method returns a `Task` which will eventually be resolved as a response message. - -For instance, if you do not expect any response, you can easily make the `EventBus` resolve a `Task` immediately to -undefined: - -```csharp -public record Record(Version Version) : Command(false) -{ - public Version Version = Version; -} - -var command = new Record(new Version("1.1.1")); -await bus.Execute(command); -``` - -The `HttpCommandDispatcher` is an alternative way to execute the commands over HTTP. To start, you should create -an `HttpCommandDispatcher` instance by passing the following options to the constructor: - -```csharp -var httpDispatcher = serviceProvider.GetService(); -``` - -The command dispatcher can be customized using the following options: - -| Option | Description | -| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `BaseUrl` | Base URL for your application instance, e.g. `https://app.brightsec.com` | -| `Token` | API key to access the API. Find out how to obtain [personal](https://docs.brightsec.com/docs/manage-your-personal-account#manage-your-personal-api-keys-authentication-tokens) and [organization](https://docs.brightsec.com/docs/manage-your-organization#manage-organization-apicli-authentication-tokens) API keys in the knowledgebase | -| `Timeout` | Time to wait for a server to send response headers (and start the response body) before aborting the request. Default 10000 ms | - -Then you have to create an instance of `HttpRequest` instead of a custom command, specifying the `Url` and `Method` in -addition to the `Body` that a command accepts by default: - -```csharp -var body = JsonContent.Create(new { Foo = "bar" }); -var command = new HttpRequest(url: "/api/v1/repeaters", - method: HttpMethods.Post, - body: body); -``` - -Once it is done, you can perform a request using `HttpComandDispatcher` as follows: - -```csharp -var response = await httpDispatcher.Execute(command); -``` - -Below you will find a list of parameters that can be used to configure a command: - -| Option | Description | -| --------------- | ------------------------------------------------------------------------------------------ | -| `Url` | Absolute URL or path that will be used for the request. By default, `/` | -| `Method` | HTTP method that is going to be used when making the request. By default, `HttpMethod.Get` | -| `Params` | Use to set query parameters. | -| `Body` | Message that we want to transmit to the remote service. | -| `ExpectReply` | Indicates whether to wait for a reply. By default true. | -| `Ttl` | Period of time that command should be handled before being discarded. By default 10000 ms. | -| `Type` | The name of a command. By default, it is the name of specific class. | -| `CorrelationId` | Used to ensure atomicity while working with EventBus. By default, random UUID. | -| `CreatedAt` | The exact date and time the command was created. | - -For more information, please see `SecTester.Core`. - -#### Retry Strategy - -For some noncritical operations, it is better to fail as soon as possible rather than retry a coupe of times. -For example, it is better to fail right after a smaller number of retries with only a short delay between retry -attempts, and display a message to the user. - -By default, you can use the [Exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) retry strategy to -retry an action when errors like `SocketException` appear. - -You can implement your own to match the business requirements and the nature of the failure: - -```csharp -public class CustomRetryStrategy: IRetryStrategy -{ - public async Task Acquire(task: Func>) { - var times = 0; - - for (;;) { - try - { - return await task(); - } catch - { - times++; - - if (times == 3) - { - throw; - } - } - } - } -} -``` - -Once a retry strategy is implemented, you can register it in the IoC container: - -```csharp -collection.AddSingleton(); -``` - -## License - -Copyright © 2022 [Bright Security](https://brightsec.com/). - -This project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details. diff --git a/src/SecTester.Bus/SecTester.Bus.csproj b/src/SecTester.Bus/SecTester.Bus.csproj deleted file mode 100644 index 7ceae84..0000000 --- a/src/SecTester.Bus/SecTester.Bus.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - netstandard2.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - <_Parameter1>$(MSBuildProjectName).Tests - - - diff --git a/src/SecTester.Bus/packages.lock.json b/src/SecTester.Bus/packages.lock.json deleted file mode 100644 index 37bdf41..0000000 --- a/src/SecTester.Bus/packages.lock.json +++ /dev/null @@ -1,302 +0,0 @@ -{ - "version": 1, - "dependencies": { - ".NETStandard,Version=v2.0": { - "Macross.Json.Extensions": { - "type": "Direct", - "requested": "[3.0.0, )", - "resolved": "3.0.0", - "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", - "dependencies": { - "System.Reflection.Emit.Lightweight": "4.7.0", - "System.Text.Json": "6.0.0" - } - }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.Extensions.Http": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0" - } - }, - "NETStandard.Library": { - "type": "Direct", - "requested": "[2.0.3, )", - "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - } - }, - "RabbitMQ.Client": { - "type": "Direct", - "requested": "[6.4.0, )", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, - "System.Text.Json": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.RateLimiting": { - "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "tq2wXyh3fL17EMF2bXgRhU7JrbO3on93MRKYxzz4JzzvuGSA1l0W3GI9/tl8EO89TH+KWEymP7bcFway6z9fXg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "qWzV9o+ZRWq+pGm+1dF+R7qTgTYoXvbyowRoBxQJGfqTpqDun2eteerjRQhq5PQ/14S+lqto3Ft4gYaRyl4rdQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "b3ErKzND8LIC7o08QAVlKfaEIYEvLJbtmVbFZVBRXeu9YkKfSSzLZfR1SUfQPBIy9mKLhEtJgGYImkcMNaKE0A==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "Microsoft.Extensions.DependencyInjection": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "System.Diagnostics.DiagnosticSource": "6.0.0" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4" - } - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "ZDskjagmBAbv+K8rYW9VhjPplhbOE63xUD0DiuydZJwt15dRyoqicYklLd86zzeintUc7AptDkHn+YhhYkYo8A==", - "dependencies": { - "Microsoft.Extensions.Configuration": "6.0.0", - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Configuration.Binder": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "Microsoft.Extensions.Options.ConfigurationExtensions": "6.0.0" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "gsqKzOEdsvq28QiXFxagmn1oRB9GeI5GgYCkoybZtQA0IUb7QPwf1WmN3AwJeNIsadTvIFQCiVK0OVIgKfOBGg==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging.Configuration": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "System.Buffers": "4.5.1", - "System.Text.Json": "6.0.0" - } - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0", - "System.ComponentModel.Annotations": "5.0.0" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "bXWINbTn0vC0FYc9GaQTISbxhQLAMrvtbuvD9N6JelEaIS/Pr62wUCinrq5bf1WRBGczt1v4wDhxFtVFNcMdUQ==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Configuration.Binder": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.5.1", - "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" - }, - "System.ComponentModel.Annotations": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "dMkqfy2el8A8/I76n2Hi1oBFEbG1SfxD2l5nhwXV3XjlnOmwxJlQbYpJH4W51odnU9sARCSAgv7S3CyAFMkpYg==" - }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Memory": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.4.0", - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - } - }, - "System.Numerics.Vectors": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" - }, - "System.Reflection.Emit.ILGeneration": { - "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "AucBYo3DSI0IDxdUjKksBcQJXPHyoPyrCXYURW1WDsLI4M65Ar/goSHjdnHOAY9MiYDNKqDlIgaYm+zL2hA1KA==" - }, - "System.Reflection.Emit.Lightweight": { - "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "a4OLB4IITxAXJeV74MDx49Oq2+PsF6Sml54XAFv+2RyWwtDBcabzoxiiJRhdhx+gaohLh4hEGCLQyBozXoQPqA==", - "dependencies": { - "System.Reflection.Emit.ILGeneration": "4.7.0" - } - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - } - }, - "sectester.core": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" - } - } - } - } -} \ No newline at end of file diff --git a/src/SecTester.Core/Bus/Event.cs b/src/SecTester.Core/Bus/Event.cs deleted file mode 100644 index 271cd35..0000000 --- a/src/SecTester.Core/Bus/Event.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading.Tasks; - -namespace SecTester.Core.Bus; - -public record Event : Message -{ - public Task Publish(IEventDispatcher dispatcher) - { - return dispatcher.Publish(this); - } -} diff --git a/src/SecTester.Core/Bus/IEventBus.cs b/src/SecTester.Core/Bus/IEventBus.cs deleted file mode 100644 index 2b28e73..0000000 --- a/src/SecTester.Core/Bus/IEventBus.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace SecTester.Core.Bus; - -public interface IEventBus : IEventDispatcher, ICommandDispatcher, IDisposable -{ - void Register() - where THandler : IEventListener - where TEvent : Event; - - void Register() - where THandler : IEventListener - where TEvent : Event; - - void Unregister() - where THandler : IEventListener - where TEvent : Event; - - void Unregister() - where THandler : IEventListener - where TEvent : Event; -} diff --git a/src/SecTester.Core/Bus/IEventDispatcher.cs b/src/SecTester.Core/Bus/IEventDispatcher.cs deleted file mode 100644 index 2002435..0000000 --- a/src/SecTester.Core/Bus/IEventDispatcher.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Threading.Tasks; - -namespace SecTester.Core.Bus; - -public interface IEventDispatcher -{ - Task Publish(TEvent message) where TEvent : Event; -} diff --git a/src/SecTester.Core/Bus/IEventListener.cs b/src/SecTester.Core/Bus/IEventListener.cs deleted file mode 100644 index 916223c..0000000 --- a/src/SecTester.Core/Bus/IEventListener.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading.Tasks; - -namespace SecTester.Core.Bus; - -public interface IEventListener where TEvent : Event -{ - Task Handle(TEvent message); -} - -public interface IEventListener : IEventListener where TEvent : Event -{ } diff --git a/src/SecTester.Core/Configuration.cs b/src/SecTester.Core/Configuration.cs index 293a636..527ee87 100644 --- a/src/SecTester.Core/Configuration.cs +++ b/src/SecTester.Core/Configuration.cs @@ -17,8 +17,6 @@ public class Configuration private readonly string[] _loopbackAddresses = { "localhost", "127.0.0.1", "::1" }; private readonly List _credentialProviders; - public string Bus { get; private set; } - public string Api { get; private set; } public Credentials? Credentials { get; private set; } @@ -91,12 +89,10 @@ private void ResolveUrls(Uri uri) if (_loopbackAddresses.Any(address => address == host)) { - Bus = $"amqp://{host}:5672"; Api = $"http://{host}:8000"; } else { - Bus = $"amqps://amq.{host}:5672"; Api = $"https://{host}"; } } diff --git a/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs b/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs index f0ee384..9ff7c2a 100644 --- a/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs +++ b/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Text; -using SecTester.Bus.Commands; -using SecTester.Bus.Dispatchers; +using SecTester.Repeater.Commands; +using SecTester.Repeater.Dispatchers; namespace SecTester.Repeater.Api; diff --git a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs index f3ef810..b18390b 100644 --- a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs +++ b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs @@ -1,5 +1,5 @@ using System.Net.Http; -using SecTester.Bus.Commands; +using SecTester.Repeater.Commands; using SecTester.Core; namespace SecTester.Repeater.Api; diff --git a/src/SecTester.Bus/Commands/HttpRequest.cs b/src/SecTester.Repeater/Commands/HttpRequest.cs similarity index 94% rename from src/SecTester.Bus/Commands/HttpRequest.cs rename to src/SecTester.Repeater/Commands/HttpRequest.cs index 762a644..d7ec4a9 100644 --- a/src/SecTester.Bus/Commands/HttpRequest.cs +++ b/src/SecTester.Repeater/Commands/HttpRequest.cs @@ -3,7 +3,7 @@ using System.Net.Http; using SecTester.Core.Bus; -namespace SecTester.Bus.Commands; +namespace SecTester.Repeater.Commands; public record HttpRequest : Command { diff --git a/src/SecTester.Bus/Dispatchers/HttpCommandDispatcher.cs b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs similarity index 97% rename from src/SecTester.Bus/Dispatchers/HttpCommandDispatcher.cs rename to src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs index f39286b..f7f58e2 100644 --- a/src/SecTester.Bus/Dispatchers/HttpCommandDispatcher.cs +++ b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs @@ -5,12 +5,12 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using SecTester.Bus.Commands; -using SecTester.Bus.Extensions; +using SecTester.Repeater.Commands; +using SecTester.Repeater.Extensions; using SecTester.Core.Bus; using SecTester.Core.Utils; -namespace SecTester.Bus.Dispatchers; +namespace SecTester.Repeater.Dispatchers; public class HttpCommandDispatcher : ICommandDispatcher { diff --git a/src/SecTester.Bus/Dispatchers/HttpCommandDispatcherConfig.cs b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs similarity index 74% rename from src/SecTester.Bus/Dispatchers/HttpCommandDispatcherConfig.cs rename to src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs index aceaefc..7c8a0cd 100644 --- a/src/SecTester.Bus/Dispatchers/HttpCommandDispatcherConfig.cs +++ b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs @@ -1,5 +1,5 @@ using System; -namespace SecTester.Bus.Dispatchers; +namespace SecTester.Repeater.Dispatchers; public sealed record HttpCommandDispatcherConfig(string BaseUrl, string Token, TimeSpan? Timeout = null); diff --git a/src/SecTester.Bus/Dispatchers/MessageSerializer.cs b/src/SecTester.Repeater/Dispatchers/MessageSerializer.cs similarity index 79% rename from src/SecTester.Bus/Dispatchers/MessageSerializer.cs rename to src/SecTester.Repeater/Dispatchers/MessageSerializer.cs index 0fa2e9e..ca41c5a 100644 --- a/src/SecTester.Bus/Dispatchers/MessageSerializer.cs +++ b/src/SecTester.Repeater/Dispatchers/MessageSerializer.cs @@ -1,9 +1,9 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; -using SecTester.Bus.Internal; +using SecTester.Repeater.Internal; -namespace SecTester.Bus.Dispatchers; +namespace SecTester.Repeater.Dispatchers; public static class MessageSerializer { @@ -16,8 +16,8 @@ public static class MessageSerializer Converters = { new JsonHttpMethodEnumerationStringConverter(), - new JsonStringEnumMemberConverter(SnakeCaseNamingPolicy.Instance, false), - new HeadersConverter() + new JsonStringEnumMemberConverter(JsonSnakeCaseNamingPolicy.Instance, false), + new JsonHeadersConverter() } }; diff --git a/src/SecTester.Bus/Dispatchers/RateLimitedHandler.cs b/src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs similarity index 97% rename from src/SecTester.Bus/Dispatchers/RateLimitedHandler.cs rename to src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs index b3e86e0..be370fa 100644 --- a/src/SecTester.Bus/Dispatchers/RateLimitedHandler.cs +++ b/src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs @@ -7,7 +7,7 @@ using System.Threading.RateLimiting; using System.Threading.Tasks; -namespace SecTester.Bus.Dispatchers; +namespace SecTester.Repeater.Dispatchers; [ExcludeFromCodeCoverage] internal sealed class RateLimitedHandler diff --git a/src/SecTester.Bus/Exceptions/HttpStatusException.cs b/src/SecTester.Repeater/Exceptions/HttpStatusException.cs similarity index 89% rename from src/SecTester.Bus/Exceptions/HttpStatusException.cs rename to src/SecTester.Repeater/Exceptions/HttpStatusException.cs index e515507..6ff452b 100644 --- a/src/SecTester.Bus/Exceptions/HttpStatusException.cs +++ b/src/SecTester.Repeater/Exceptions/HttpStatusException.cs @@ -1,7 +1,7 @@ using System.Net; using System.Net.Http; -namespace SecTester.Bus.Exceptions; +namespace SecTester.Repeater.Exceptions; public class HttpStatusException : HttpRequestException { diff --git a/src/SecTester.Bus/Extensions/HttpResponseMessageExtensions.cs b/src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs similarity index 95% rename from src/SecTester.Bus/Extensions/HttpResponseMessageExtensions.cs rename to src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs index 42e8908..744343a 100644 --- a/src/SecTester.Bus/Extensions/HttpResponseMessageExtensions.cs +++ b/src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using SecTester.Bus.Exceptions; +using SecTester.Repeater.Exceptions; -namespace SecTester.Bus.Extensions; +namespace SecTester.Repeater.Extensions; internal static class HttpResponseMessageExtensions { diff --git a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs index eaa0dd6..92be4a6 100644 --- a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs +++ b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs @@ -2,25 +2,30 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Threading.RateLimiting; using Microsoft.Extensions.DependencyInjection; +using SecTester.Core; +using SecTester.Core.Bus; using SecTester.Core.Utils; using SecTester.Repeater.Api; using SecTester.Repeater.Bus; +using SecTester.Repeater.Dispatchers; +using SecTester.Repeater.RetryStrategies; using SecTester.Repeater.Runners; namespace SecTester.Repeater.Extensions; public static class ServiceCollectionExtensions { - public static IServiceCollection AddSecTesterRepeater(this IServiceCollection collection) - { - return AddSecTesterRepeater(collection, new RequestRunnerOptions()); - } + public static IServiceCollection AddSecTesterRepeater(this IServiceCollection collection) => + AddSecTesterRepeater(collection, new RequestRunnerOptions()); - public static IServiceCollection AddSecTesterRepeater(this IServiceCollection collection, RequestRunnerOptions options) - { - return collection + public static IServiceCollection AddSecTesterRepeater(this IServiceCollection collection, RequestRunnerOptions options) => + collection .AddSingleton(options) + .AddHttpCommandDispatcher() + .AddSingleton(new ExponentialBackoffOptions()) + .AddSingleton() .AddSingleton() .AddScoped() .AddScoped() @@ -30,17 +35,16 @@ public static IServiceCollection AddSecTesterRepeater(this IServiceCollection co protocol => sp.GetServices().FirstOrDefault(x => x.Protocol == protocol) ) .AddHttpClientForHttpRequestRunner(); - } private static IServiceCollection AddHttpClientForHttpRequestRunner(this IServiceCollection collection) { - collection.AddHttpClient(nameof(HttpRequestRunner), ConfigureHttpClient) - .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandler); + collection.AddHttpClient(nameof(HttpRequestRunner), ConfigureHttpClientForHttpRequestRunner) + .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandlerForHttpRequestRunner); return collection; } - private static HttpMessageHandler CreateHttpMessageHandler(IServiceProvider sp) + private static HttpMessageHandler CreateHttpMessageHandlerForHttpRequestRunner(IServiceProvider sp) { var config = sp.GetRequiredService(); var proxy = config.ProxyUrl is not null ? new WebProxy(config.ProxyUrl) : null; @@ -54,7 +58,7 @@ private static HttpMessageHandler CreateHttpMessageHandler(IServiceProvider sp) }; } - private static void ConfigureHttpClient(IServiceProvider sp, HttpClient client) + private static void ConfigureHttpClientForHttpRequestRunner(IServiceProvider sp, HttpClient client) { var config = sp.GetRequiredService(); @@ -71,4 +75,43 @@ private static void ConfigureHttpClient(IServiceProvider sp, HttpClient client) client.DefaultRequestHeaders.Add("Keep-Alive", config.Timeout.ToString()); } } + + private static IServiceCollection AddHttpCommandDispatcher(this IServiceCollection collection) => + collection + .AddScoped(sp => + { + var config = sp.GetRequiredService(); + return new HttpCommandDispatcherConfig(config.Api, config.Credentials!.Token, TimeSpan.FromSeconds(10)); + }) + .AddScoped() + .AddScoped(sp => sp.GetRequiredService()) + .AddHttpClientForHttpCommandDispatcher(); + + private static IServiceCollection AddHttpClientForHttpCommandDispatcher(this IServiceCollection collection) + { + collection + .AddHttpClient(nameof(HttpCommandDispatcher), ConfigureHttpClientForHttpCommandDispatcher) + .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandlerForHttpCommandDispatcher); + + return collection; + } + + private static HttpMessageHandler CreateHttpMessageHandlerForHttpCommandDispatcher() + { + var options = new FixedWindowRateLimiterOptions + { + Window = TimeSpan.FromSeconds(60), + PermitLimit = 10, + QueueLimit = 5 + }; + var rateLimiter = new FixedWindowRateLimiter(options); + + return new RateLimitedHandler(rateLimiter); + } + + private static void ConfigureHttpClientForHttpCommandDispatcher(IServiceProvider sp, HttpClient client) + { + var config = sp.GetRequiredService(); + client.Timeout = (TimeSpan)config.Timeout!; + } } diff --git a/src/SecTester.Bus/Internal/HeadersConverter.cs b/src/SecTester.Repeater/Internal/JsonHeadersConverter.cs similarity index 92% rename from src/SecTester.Bus/Internal/HeadersConverter.cs rename to src/SecTester.Repeater/Internal/JsonHeadersConverter.cs index ccab3e3..23662eb 100644 --- a/src/SecTester.Bus/Internal/HeadersConverter.cs +++ b/src/SecTester.Repeater/Internal/JsonHeadersConverter.cs @@ -4,14 +4,14 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace SecTester.Bus.Internal; +namespace SecTester.Repeater.Internal; -internal sealed class HeadersConverter : JsonConverter>>> +internal sealed class JsonHeadersConverter : JsonConverter>>> { private static readonly Type Type = typeof(IEnumerable>>); private readonly bool _keepSingleElementSequence; - internal HeadersConverter(bool keepSingleElementSequence = false) + internal JsonHeadersConverter(bool keepSingleElementSequence = false) { _keepSingleElementSequence = keepSingleElementSequence; } diff --git a/src/SecTester.Bus/Internal/JsonHttpMethodEnumerationStringConverter.cs b/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs similarity index 98% rename from src/SecTester.Bus/Internal/JsonHttpMethodEnumerationStringConverter.cs rename to src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs index c7f4458..0d1b322 100644 --- a/src/SecTester.Bus/Internal/JsonHttpMethodEnumerationStringConverter.cs +++ b/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs @@ -6,7 +6,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace SecTester.Bus.Internal; +namespace SecTester.Repeater.Internal; internal class JsonHttpMethodEnumerationStringConverter : JsonConverter { diff --git a/src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs b/src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs new file mode 100644 index 0000000..83f47e5 --- /dev/null +++ b/src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs @@ -0,0 +1,14 @@ +using System.Text.Json; +using SecTester.Core.Utils; + +namespace SecTester.Repeater.Internal; + +internal class JsonSnakeCaseNamingPolicy : JsonNamingPolicy +{ + public static JsonNamingPolicy Instance { get; } = new JsonSnakeCaseNamingPolicy(); + + public override string ConvertName(string name) + { + return name.ToSnakeCase(); + } +} diff --git a/src/SecTester.Bus/RetryStrategies/ExponentialBackoffIRetryStrategy.cs b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs similarity index 81% rename from src/SecTester.Bus/RetryStrategies/ExponentialBackoffIRetryStrategy.cs rename to src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs index 77f5142..71799e5 100644 --- a/src/SecTester.Bus/RetryStrategies/ExponentialBackoffIRetryStrategy.cs +++ b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs @@ -2,11 +2,10 @@ using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; -using RabbitMQ.Client.Exceptions; -using SecTester.Bus.Exceptions; +using SecTester.Repeater.Exceptions; using SecTester.Core.Bus; -namespace SecTester.Bus.RetryStrategies; +namespace SecTester.Repeater.RetryStrategies; public class ExponentialBackoffIRetryStrategy : IRetryStrategy { @@ -46,6 +45,6 @@ public async Task Acquire(Func> task, Cancellati private static bool ShouldRetry(Exception err) { - return err is SocketException or BrokerUnreachableException or TaskCanceledException or HttpStatusException { Retryable: true }; + return err is SocketException or TaskCanceledException or HttpStatusException { Retryable: true }; } } diff --git a/src/SecTester.Bus/RetryStrategies/ExponentialBackoffOptions.cs b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs similarity index 64% rename from src/SecTester.Bus/RetryStrategies/ExponentialBackoffOptions.cs rename to src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs index 32f80bd..63e040d 100644 --- a/src/SecTester.Bus/RetryStrategies/ExponentialBackoffOptions.cs +++ b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs @@ -1,3 +1,3 @@ -namespace SecTester.Bus.RetryStrategies; +namespace SecTester.Repeater.RetryStrategies; public record ExponentialBackoffOptions(int MaxDepth = 3, int MinInterval = 50); diff --git a/src/SecTester.Repeater/SecTester.Repeater.csproj b/src/SecTester.Repeater/SecTester.Repeater.csproj index 1bbf68f..97d1f41 100644 --- a/src/SecTester.Repeater/SecTester.Repeater.csproj +++ b/src/SecTester.Repeater/SecTester.Repeater.csproj @@ -5,21 +5,28 @@ - + + + + + - - + + + + + diff --git a/src/SecTester.Repeater/packages.lock.json b/src/SecTester.Repeater/packages.lock.json index 149aa87..d47533b 100644 --- a/src/SecTester.Repeater/packages.lock.json +++ b/src/SecTester.Repeater/packages.lock.json @@ -2,6 +2,25 @@ "version": 1, "dependencies": { ".NETStandard,Version=v2.0": { + "Macross.Json.Extensions": { + "type": "Direct", + "requested": "[3.0.0, )", + "resolved": "3.0.0", + "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", + "dependencies": { + "System.Reflection.Emit.Lightweight": "4.7.0", + "System.Text.Json": "6.0.0" + } + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Direct", "requested": "[6.0.0, )", @@ -12,6 +31,18 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, + "Microsoft.Extensions.Http": { + "type": "Direct", + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -52,13 +83,29 @@ "Microsoft.Bcl.AsyncInterfaces": "6.0.0" } }, - "Macross.Json.Extensions": { - "type": "Transitive", - "resolved": "3.0.0", - "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", + "System.Text.Json": { + "type": "Direct", + "requested": "[7.0.3, )", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { - "System.Reflection.Emit.Lightweight": "4.7.0", - "System.Text.Json": "6.0.0" + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Threading.RateLimiting": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" } }, "MessagePack": { @@ -81,14 +128,6 @@ "resolved": "2.5.124", "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, "Microsoft.Extensions.Configuration": { "type": "Transitive", "resolved": "6.0.0", @@ -125,17 +164,6 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, - "Microsoft.Extensions.Http": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0" - } - }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "6.0.0", @@ -238,15 +266,6 @@ "resolved": "1.1.0", "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "SocketIO.Core": { "type": "Transitive", "resolved": "3.1.1", @@ -368,37 +387,6 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "7.0.3", - "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "7.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.5", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.RateLimiting": { - "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, "System.Threading.Tasks.Extensions": { "type": "Transitive", "resolved": "4.5.4", @@ -407,19 +395,6 @@ "System.Runtime.CompilerServices.Unsafe": "4.5.3" } }, - "sectester.bus": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.41.3, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" - } - }, "sectester.core": { "type": "Project", "dependencies": { diff --git a/src/SecTester.Reporter/packages.lock.json b/src/SecTester.Reporter/packages.lock.json index 544e7cd..4835eed 100644 --- a/src/SecTester.Reporter/packages.lock.json +++ b/src/SecTester.Reporter/packages.lock.json @@ -30,6 +30,26 @@ "System.Text.Json": "6.0.0" } }, + "MessagePack": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "jxJPIkCnKwZcg9qtN1WoR99nlcJl/y/HYOTQLxnyXzR4iE5xhZviCPSKXLe08fcF9Tk4hP7mm+mVVdyUfh2ALw==", + "dependencies": { + "MessagePack.Annotations": "2.5.124", + "Microsoft.Bcl.AsyncInterfaces": "6.0.0", + "Microsoft.NET.StringTools": "17.6.3", + "System.Collections.Immutable": "6.0.0", + "System.Reflection.Emit": "4.7.0", + "System.Reflection.Emit.Lightweight": "4.7.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "MessagePack.Annotations": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "7.0.0", @@ -168,18 +188,66 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "Microsoft.NET.StringTools": { + "type": "Transitive", + "resolved": "17.6.3", + "contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA==", + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, - "RabbitMQ.Client": { + "Microsoft.NETCore.Targets": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" + }, + "SocketIO.Core": { "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", + "resolved": "3.1.1", + "contentHash": "L5GSyODDjlub5YdDxfsRtA9uxBNw1Hs/egEMhdOGFyD0c63VmvWQ1A4Gfc4GYKYInz1muP4C8QNblXErnUYDqA==" + }, + "SocketIO.Serializer.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "aFanlt2GOGEy7GTGLyh8f8SwhtmQwoPOHTAYCQ0brjg05Nb3F38sk4hYogpII5imyZ7w0spqwNHwpl7FZ49HOA==", "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" + "SocketIO.Core": "3.1.1" + } + }, + "SocketIO.Serializer.MessagePack": { + "type": "Transitive", + "resolved": "3.1.2", + "contentHash": "eYSPq7aKP11crDqGA5XlcGtQBqbeydbzgKb6FgySAlUqgGWZ2foXuQLIiBbPJPuH6ygaqycvQimw+oz5328AeA==", + "dependencies": { + "MessagePack": "2.5.124", + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1" + } + }, + "SocketIO.Serializer.SystemTextJson": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "1PKQ+hOAJ4l3ZXlrVgiB3uNY3kLhjzYjnxk/97V6npJrNmhq09Di2EQSpGweQMu6KPbOxjZ7eYVARkGTWIUsjg==", + "dependencies": { + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1", + "System.Text.Json": "7.0.3" + } + }, + "SocketIOClient": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "g8Lauia1Cj5DBXeC9j6vDSJeQEboGmXsnduW06VOBMe+UgqCrenxszYXJg19rAjwO10XRWQorOuU1XNMfYo8Xg==", + "dependencies": { + "SocketIO.Serializer.Core": "3.1.1", + "SocketIO.Serializer.SystemTextJson": "3.1.1", + "System.Collections": "4.3.0" } }, "System.Buffers": { @@ -187,6 +255,25 @@ "resolved": "4.5.1", "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" }, + "System.Collections": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", + "dependencies": { + "System.Memory": "4.5.4", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "System.ComponentModel.Annotations": { "type": "Transitive", "resolved": "5.0.0", @@ -211,8 +298,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", "dependencies": { "System.Buffers": "4.5.1", "System.Numerics.Vectors": "4.4.0", @@ -224,6 +311,14 @@ "resolved": "4.5.0", "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" }, + "System.Reflection.Emit": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ==", + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.7.0" + } + }, "System.Reflection.Emit.ILGeneration": { "type": "Transitive", "resolved": "4.7.0", @@ -237,6 +332,15 @@ "System.Reflection.Emit.ILGeneration": "4.7.0" } }, + "System.Runtime": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", "resolved": "6.0.0", @@ -244,33 +348,25 @@ }, "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", + "System.Memory": "4.5.5", "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Text.Json": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", + "System.Memory": "4.5.5", "System.Numerics.Vectors": "4.5.0", "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==", - "dependencies": { + "System.Text.Encodings.Web": "7.0.0", "System.Threading.Tasks.Extensions": "4.5.4" } }, @@ -291,25 +387,27 @@ "System.Runtime.CompilerServices.Unsafe": "4.5.3" } }, - "sectester.bus": { + "sectester.core": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "Microsoft.Extensions.Logging": "[6.0.0, )", + "Microsoft.Extensions.Logging.Console": "[6.0.0, )" } }, - "sectester.core": { + "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", + "SocketIO.Serializer.MessagePack": "[3.1.2, )", + "SocketIOClient": "[3.1.1, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.scan": { @@ -317,10 +415,9 @@ "dependencies": { "Macross.Json.Extensions": "[3.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.40.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", + "System.Linq.Async": "[6.0.1, )" } } } diff --git a/src/SecTester.Runner/SecRunner.cs b/src/SecTester.Runner/SecRunner.cs index 6a3eae1..deb9878 100644 --- a/src/SecTester.Runner/SecRunner.cs +++ b/src/SecTester.Runner/SecRunner.cs @@ -2,7 +2,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using SecTester.Bus.Extensions; using SecTester.Core; using SecTester.Core.Extensions; using SecTester.Repeater; @@ -51,7 +50,6 @@ public static async Task Create(Configuration configuration) var collection = new ServiceCollection() .AddSecTesterConfig(configuration) - .AddSecTesterBus() .AddSecTesterRepeater() .AddSecTesterScan() .AddScoped() diff --git a/src/SecTester.Runner/packages.lock.json b/src/SecTester.Runner/packages.lock.json index ae4d9cd..aed97d1 100644 --- a/src/SecTester.Runner/packages.lock.json +++ b/src/SecTester.Runner/packages.lock.json @@ -207,15 +207,6 @@ "resolved": "1.1.0", "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "SocketIO.Core": { "type": "Transitive", "resolved": "3.1.1", @@ -379,14 +370,6 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, "System.Threading.RateLimiting": { "type": "Transitive", "resolved": "7.0.0", @@ -404,19 +387,6 @@ "System.Runtime.CompilerServices.Unsafe": "4.5.3" } }, - "sectester.bus": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.41.3, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" - } - }, "sectester.core": { "type": "Project", "dependencies": { @@ -428,19 +398,23 @@ "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.41.3, )", - "SecTester.Core": "[0.41.3, )", + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )" + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.reporter": { "type": "Project", "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Scan": "[0.41.3, )" + "SecTester.Scan": "[0.41.4, )" } }, "sectester.scan": { @@ -448,10 +422,9 @@ "dependencies": { "Macross.Json.Extensions": "[3.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.41.3, )", - "SecTester.Core": "[0.41.3, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", + "System.Linq.Async": "[6.0.1, )" } } } diff --git a/src/SecTester.Scan/Commands/CreateScan.cs b/src/SecTester.Scan/Commands/CreateScan.cs index ffff661..0a57a0e 100644 --- a/src/SecTester.Scan/Commands/CreateScan.cs +++ b/src/SecTester.Scan/Commands/CreateScan.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Text; -using SecTester.Bus.Commands; -using SecTester.Bus.Dispatchers; +using SecTester.Repeater.Commands; +using SecTester.Repeater.Dispatchers; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/DeleteScan.cs b/src/SecTester.Scan/Commands/DeleteScan.cs index dc972d0..19796ed 100644 --- a/src/SecTester.Scan/Commands/DeleteScan.cs +++ b/src/SecTester.Scan/Commands/DeleteScan.cs @@ -1,4 +1,4 @@ -using SecTester.Bus.Commands; +using SecTester.Repeater.Commands; using SecTester.Core; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/GetScan.cs b/src/SecTester.Scan/Commands/GetScan.cs index 6cfc341..979d829 100644 --- a/src/SecTester.Scan/Commands/GetScan.cs +++ b/src/SecTester.Scan/Commands/GetScan.cs @@ -1,4 +1,4 @@ -using SecTester.Bus.Commands; +using SecTester.Repeater.Commands; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/ListIssues.cs b/src/SecTester.Scan/Commands/ListIssues.cs index dc7a7f6..171fd7c 100644 --- a/src/SecTester.Scan/Commands/ListIssues.cs +++ b/src/SecTester.Scan/Commands/ListIssues.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using SecTester.Bus.Commands; +using SecTester.Repeater.Commands; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/StopScan.cs b/src/SecTester.Scan/Commands/StopScan.cs index e4e9725..64f930c 100644 --- a/src/SecTester.Scan/Commands/StopScan.cs +++ b/src/SecTester.Scan/Commands/StopScan.cs @@ -1,4 +1,4 @@ -using SecTester.Bus.Commands; +using SecTester.Repeater.Commands; using SecTester.Core; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/UploadHar.cs b/src/SecTester.Scan/Commands/UploadHar.cs index f338cca..b51e270 100644 --- a/src/SecTester.Scan/Commands/UploadHar.cs +++ b/src/SecTester.Scan/Commands/UploadHar.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Net.Http; using System.Text; -using SecTester.Bus.Commands; -using SecTester.Bus.Dispatchers; +using SecTester.Repeater.Commands; +using SecTester.Repeater.Dispatchers; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/SecTester.Scan.csproj b/src/SecTester.Scan/SecTester.Scan.csproj index 0b8355d..edfc6a8 100644 --- a/src/SecTester.Scan/SecTester.Scan.csproj +++ b/src/SecTester.Scan/SecTester.Scan.csproj @@ -5,13 +5,12 @@ - + - diff --git a/src/SecTester.Scan/packages.lock.json b/src/SecTester.Scan/packages.lock.json index 15f9d14..5abaabc 100644 --- a/src/SecTester.Scan/packages.lock.json +++ b/src/SecTester.Scan/packages.lock.json @@ -40,21 +40,26 @@ "Microsoft.Bcl.AsyncInterfaces": "6.0.0" } }, - "System.Text.Json": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "MessagePack": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "jxJPIkCnKwZcg9qtN1WoR99nlcJl/y/HYOTQLxnyXzR4iE5xhZviCPSKXLe08fcF9Tk4hP7mm+mVVdyUfh2ALw==", "dependencies": { + "MessagePack.Annotations": "2.5.124", "Microsoft.Bcl.AsyncInterfaces": "6.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Numerics.Vectors": "4.5.0", + "Microsoft.NET.StringTools": "17.6.3", + "System.Collections.Immutable": "6.0.0", + "System.Reflection.Emit": "4.7.0", + "System.Reflection.Emit.Lightweight": "4.7.0", "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0", "System.Threading.Tasks.Extensions": "4.5.4" } }, + "MessagePack.Annotations": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "7.0.0", @@ -193,18 +198,66 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "Microsoft.NET.StringTools": { + "type": "Transitive", + "resolved": "17.6.3", + "contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA==", + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" }, - "RabbitMQ.Client": { + "Microsoft.NETCore.Targets": { "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", + "resolved": "1.1.0", + "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" + }, + "SocketIO.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "L5GSyODDjlub5YdDxfsRtA9uxBNw1Hs/egEMhdOGFyD0c63VmvWQ1A4Gfc4GYKYInz1muP4C8QNblXErnUYDqA==" + }, + "SocketIO.Serializer.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "aFanlt2GOGEy7GTGLyh8f8SwhtmQwoPOHTAYCQ0brjg05Nb3F38sk4hYogpII5imyZ7w0spqwNHwpl7FZ49HOA==", "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" + "SocketIO.Core": "3.1.1" + } + }, + "SocketIO.Serializer.MessagePack": { + "type": "Transitive", + "resolved": "3.1.2", + "contentHash": "eYSPq7aKP11crDqGA5XlcGtQBqbeydbzgKb6FgySAlUqgGWZ2foXuQLIiBbPJPuH6ygaqycvQimw+oz5328AeA==", + "dependencies": { + "MessagePack": "2.5.124", + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1" + } + }, + "SocketIO.Serializer.SystemTextJson": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "1PKQ+hOAJ4l3ZXlrVgiB3uNY3kLhjzYjnxk/97V6npJrNmhq09Di2EQSpGweQMu6KPbOxjZ7eYVARkGTWIUsjg==", + "dependencies": { + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1", + "System.Text.Json": "7.0.3" + } + }, + "SocketIOClient": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "g8Lauia1Cj5DBXeC9j6vDSJeQEboGmXsnduW06VOBMe+UgqCrenxszYXJg19rAjwO10XRWQorOuU1XNMfYo8Xg==", + "dependencies": { + "SocketIO.Serializer.Core": "3.1.1", + "SocketIO.Serializer.SystemTextJson": "3.1.1", + "System.Collections": "4.3.0" } }, "System.Buffers": { @@ -212,6 +265,25 @@ "resolved": "4.5.1", "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" }, + "System.Collections": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==", + "dependencies": { + "System.Memory": "4.5.4", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "System.ComponentModel.Annotations": { "type": "Transitive", "resolved": "5.0.0", @@ -228,8 +300,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", "dependencies": { "System.Buffers": "4.5.1", "System.Numerics.Vectors": "4.4.0", @@ -241,6 +313,14 @@ "resolved": "4.5.0", "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" }, + "System.Reflection.Emit": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ==", + "dependencies": { + "System.Reflection.Emit.ILGeneration": "4.7.0" + } + }, "System.Reflection.Emit.ILGeneration": { "type": "Transitive", "resolved": "4.7.0", @@ -254,6 +334,15 @@ "System.Reflection.Emit.ILGeneration": "4.7.0" } }, + "System.Runtime": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", "resolved": "6.0.0", @@ -261,19 +350,25 @@ }, "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", + "System.Memory": "4.5.5", "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, - "System.Threading.Channels": { + "System.Text.Json": { "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0", "System.Threading.Tasks.Extensions": "4.5.4" } }, @@ -294,25 +389,27 @@ "System.Runtime.CompilerServices.Unsafe": "4.5.3" } }, - "sectester.bus": { + "sectester.core": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "Microsoft.Extensions.Logging": "[6.0.0, )", + "Microsoft.Extensions.Logging.Console": "[6.0.0, )" } }, - "sectester.core": { + "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", + "SocketIO.Serializer.MessagePack": "[3.1.2, )", + "SocketIOClient": "[3.1.1, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } } } diff --git a/test/SecTester.Bus.Tests/Dispatchers/DefaultRmqConnectionManagerTests.cs b/test/SecTester.Bus.Tests/Dispatchers/DefaultRmqConnectionManagerTests.cs deleted file mode 100644 index 576c664..0000000 --- a/test/SecTester.Bus.Tests/Dispatchers/DefaultRmqConnectionManagerTests.cs +++ /dev/null @@ -1,237 +0,0 @@ -namespace SecTester.Bus.Tests.Dispatchers; - -public class DefaultRmqConnectionManagerTests : IDisposable -{ - private readonly IRmqConnectionManager _manager; - private readonly IModel _channel = Substitute.For(); - private readonly IConnection _connection = Substitute.For(); - private readonly IConnectionFactory _connectionFactory = Substitute.For(); - private readonly ILogger _logger = Substitute.For>(); - private readonly IRetryStrategy _retryStrategy = Substitute.For(); - - public DefaultRmqConnectionManagerTests() - { - _connectionFactory.CreateConnection().Returns(_connection); - _connection.CreateModel().Returns(_channel); - _retryStrategy.Acquire(Arg.Any>>()).Returns(x => x.ArgAt>>(0).Invoke()); - _connection.Endpoint.Returns(new AmqpTcpEndpoint - { - HostName = "localhost" - }); - _manager = new DefaultRmqConnectionManager(_connectionFactory, _logger, _retryStrategy); - } - - public void Dispose() - { - _retryStrategy.ClearSubstitute(); - _connection.ClearSubstitute(); - _channel.ClearSubstitute(); - _connectionFactory.ClearSubstitute(); - _logger.ClearSubstitute(); - GC.SuppressFinalize(this); - } - - [Fact] - public void CreateChannel_Connected_CreatesChannel() - { - // arrange - _manager.TryConnect(); - _connection.IsOpen.Returns(true); - - // act - var channel = _manager.CreateChannel(); - - // assert - channel.Should().NotBeNull(); - _connection.Received(1).CreateModel(); - } - - [Fact] - public void CreateChannel_NotConnected_ThrowsError() - { - // arrange - _manager.TryConnect(); - _connection.IsOpen.Returns(false); - - // act - var act = () => _manager.CreateChannel(); - - // assert - act.Should().Throw(); - } - - [Fact] - public void Consume_Connected_CreatesChannel() - { - // arrange - _manager.TryConnect(); - _connection.IsOpen.Returns(true); - - // act - var result = _manager.CreateConsumer(_channel); - - // assert - result.Should().NotBeNull(); - } - - [Fact] - public void CreateConsumer_NotConnected_ThrowsError() - { - // arrange - _manager.TryConnect(); - _connection.IsOpen.Returns(false); - - // act - var act = () => _manager.CreateConsumer(_channel); - - // assert - act.Should().Throw(); - } - - [Fact] - public void TryConnect_NotConnected_ConnectsToHost() - { - // arrange - _connection.IsOpen.Returns(false); - - // act - _manager.TryConnect(); - - // assert - _connectionFactory.Received().CreateConnection(); - } - - [Fact] - public void TryConnect_Connected_ReturnsControl() - { - // arrange - _connection.IsOpen.Returns(false, true); - - // act - _manager.TryConnect(); - _manager.TryConnect(); - - // assert - _connectionFactory.Received(1).CreateConnection(); - } - - [Fact] - public void Connect_ConnectsToHost() - { - // arrange - _connection.IsOpen.Returns(false, true); - - // act - _manager.Connect(); - - // assert - _connectionFactory.Received().CreateConnection(); - } - - [Fact] - public void Connect_ConnectionError_Retries() - { - // arrange - _connection.IsOpen.Returns(false, true); - _connectionFactory.CreateConnection().Throws(new SocketException()); - - // act - var act = () => _manager.Connect(); - - // assert - act.Should().Throw(); - _retryStrategy.Received().Acquire(Arg.Any>>()); - } - - [Fact] - public void Connect_ReconnectsOnShutdown() - { - // arrange - var shutdownEventArgs = new ShutdownEventArgs(ShutdownInitiator.Peer, 1, "something went wrong"); - _connection.IsOpen.Returns(true); - - // act - _manager.Connect(); - _connection.ConnectionShutdown += - Raise.EventWith(new object(), shutdownEventArgs); - - // assert - _connectionFactory.Received(2).CreateConnection(); - } - - [Fact] - public void Constructor_ReconnectsOnException() - { - // arrange - var exception = new Exception("something went wrong"); - var callbackExceptionEventArgs = new CallbackExceptionEventArgs(exception); - - _connection.IsOpen.Returns(true); - - // act - _manager.Connect(); - _connection.CallbackException += Raise.EventWith(new object(), callbackExceptionEventArgs); - - // assert - _connectionFactory.Received(2).CreateConnection(); - } - - [Fact] - public void Constructor_ReconnectsWhenConnectionBlocked() - { - // arrange - var connectionBlockedEventArgs = new ConnectionBlockedEventArgs("something went wrong"); - - _connection.IsOpen.Returns(true); - - // act - _manager.Connect(); - _connection.ConnectionBlocked += Raise.EventWith(new object(), connectionBlockedEventArgs); - - // assert - _connectionFactory.Received(2).CreateConnection(); - } - - [Fact] - public void Dispose_Connected_RemovesSubscriptions() - { - // arrange - _manager.Connect(); - _connection.IsOpen.Returns(true); - - // act - _manager.Dispose(); - - // assert - _connection.Received().ConnectionBlocked -= Arg.Any>(); - _connection.Received().CallbackException -= Arg.Any>(); - _connection.Received().ConnectionShutdown -= Arg.Any>(); - } - - [Fact] - public void Dispose_NotConnected_DoesNothing() - { - // arrange - _connection.IsOpen.Returns(false); - - // act - _manager.Dispose(); - - // assert - _connection.DidNotReceive().Close(); - } - - [Fact] - public void Dispose_Connected_ClosesConnection() - { - // arrange - _manager.Connect(); - _connection.IsOpen.Returns(true); - - // act - _manager.Dispose(); - - // assert - _connection.Received().Close(); - } -} diff --git a/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusOptionsTests.cs b/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusOptionsTests.cs deleted file mode 100644 index a4245fe..0000000 --- a/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusOptionsTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace SecTester.Bus.Tests.Dispatchers; - -public class RmqEventBusOptionsTests -{ - private const string Url = "amqp://example.com"; - private const string AppQueue = "app"; - private const string Exchange = "bus"; - private const string ClientQueue = "client"; - - [Fact] - public void RmqEventBusOptions_SetsDefaultOptions() - { - // arrange - var timeout = TimeSpan.FromSeconds(30); - - // act - var result = new RmqEventBusOptions(Url, AppQueue, Exchange, ClientQueue); - - // assert - result.Should().BeEquivalentTo(new - { - Url, - Exchange, - AppQueue, - ClientQueue, - PrefetchCount = 1, - ReconnectTime = timeout, - HeartbeatInterval = timeout, - ConnectTimeout = timeout - }); - } - - [Fact] - public void RmqEventBusOptions_OverrideDefaultOptions() - { - // arrange - var timeout = TimeSpan.FromSeconds(30); - var newTimeout = TimeSpan.FromSeconds(20); - const int newPrefetchCount = 30; - - // act - var result = new RmqEventBusOptions(Url, AppQueue, Exchange, ClientQueue) - { - HeartbeatInterval = newTimeout, - PrefetchCount = newPrefetchCount - }; - - // assert - result.Should().BeEquivalentTo(new - { - Url, - Exchange, - AppQueue, - ClientQueue, - PrefetchCount = newPrefetchCount, - ReconnectTime = timeout, - HeartbeatInterval = newTimeout, - ConnectTimeout = timeout - }); - } -} diff --git a/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusTests.cs b/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusTests.cs deleted file mode 100644 index 18cdb9f..0000000 --- a/test/SecTester.Bus.Tests/Dispatchers/RmqEventBusTests.cs +++ /dev/null @@ -1,471 +0,0 @@ -using SecTester.Bus.Tests.Fixtures; - -namespace SecTester.Bus.Tests.Dispatchers; - -public class RmqEventBusTests : IDisposable -{ - private static readonly JsonSerializerOptions JsonSerializerOptions = new() - { - PropertyNameCaseInsensitive = true, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - IncludeFields = true - }; - - private readonly AsyncEventingBasicConsumer _basicConsumer; - private readonly RmqEventBus _bus; - private readonly IModel _channel = Substitute.For(); - private readonly IRmqConnectionManager _connectionManager = Substitute.For(); - private readonly ILogger _logger = Substitute.For>(); - private readonly RmqEventBusOptions _options; - private readonly AsyncEventingBasicConsumer _replyConsumer; - private readonly IServiceScopeFactory _scopeFactory = Substitute.For(); - - public RmqEventBusTests() - { - _basicConsumer = new AsyncEventingBasicConsumer(_channel); - _replyConsumer = new AsyncEventingBasicConsumer(_channel); - - _connectionManager.CreateChannel().Returns(_channel); - _connectionManager.CreateConsumer(_channel).Returns(_basicConsumer, _replyConsumer); - - _options = new RmqEventBusOptions("amqp://localhost:5672", Exchange: "event-bus", ClientQueue: "Agent", AppQueue: "App"); - _bus = new RmqEventBus(_options, _connectionManager, _logger, _scopeFactory); - } - - public void Dispose() - { - _connectionManager.ClearSubstitute(); - _channel.ClearSubstitute(); - _logger.ClearSubstitute(); - _scopeFactory.ClearSubstitute(); - - GC.SuppressFinalize(this); - } - - [Fact] - public void Constructor_BindsExchangesToQueue() - { - // assert - _channel.Received().ExchangeDeclare(_options.Exchange, "direct", true); - _channel.Received().QueueDeclare(_options.ClientQueue, exclusive: false, autoDelete: true, durable: true); - _channel.Received().BasicQos(0, 1, false); - } - - [Fact] - public void Constructor_StartsConsumingRegularMessages() - { - // assert - _connectionManager.Received().CreateConsumer(Arg.Any()); - _channel.Received().BasicConsume(_options.ClientQueue, true, _basicConsumer); - } - - [Fact] - public void Constructor_StartsConsumingFromReplyQueue() - { - // assert - _connectionManager.Received().CreateConsumer(Arg.Any()); - _channel.Received().BasicConsume("amq.rabbitmq.reply-to", true, _replyConsumer); - } - - [Fact] - public void Dispose_DisposesConnection() - { - // act - _bus.Dispose(); - - // assert - _connectionManager.Received().Dispose(); - } - - [Fact] - public void Constructor_Exception_StartsBasicConsumeOneMoreTime() - { - // arrange - var exception = new Exception("something went wrong"); - var callbackExceptionEventArgs = new CallbackExceptionEventArgs(exception); - - // act - _channel.CallbackException += Raise.EventWith(new object(), callbackExceptionEventArgs); - - // assert - _channel.Received(1).Dispose(); - _connectionManager.Received().CreateConsumer(_channel); - } - - [Fact] - public void Register_AddsHandler() - { - // arrange - _connectionManager.IsConnected.Returns(true); - - // act - _bus.Register(); - - // assert - _channel.Received(1).QueueBind(_options.ClientQueue, - _options.Exchange, - nameof(ConcreteEvent)); - } - - [Fact] - public void Register_ConnectionIsLost_Reconnects() - { - // arrange - _connectionManager.IsConnected.Returns(false, true); - - // act - _bus.Register(); - - // assert - _connectionManager.Received().TryConnect(); - } - - [Fact] - public void Register_MultipleHandlersForSameEvent_AddsHandlers() - { - // arrange - _bus.Register(); - _bus.Register(); - - // assert - _channel.Received(1).QueueBind(_options.ClientQueue, - _options.Exchange, - Arg.Any()); - } - - [Fact] - public void Unregister_SingleHandler_RemovesHandler() - { - // arrange - _bus.Register(); - - // act - _bus.Unregister(); - - // assert - _channel.Received(1).QueueUnbind(_options.ClientQueue, - _options.Exchange, - nameof(ConcreteEvent)); - } - - [Fact] - public void Unregister_ConnectionIsLost_Reconnects() - { - // arrange - _bus.Register(); - - // act - _bus.Unregister(); - - // assert - _connectionManager.Received(3).TryConnect(); - } - - [Fact] - public void Unregister_NoHandler_ThrowNoSubscriptionFound() - { - // act - var act = () => _bus.Unregister(); - - // assert - act.Should().Throw(); - } - - [Fact] - public void Unregister_MultipleHandlersForSameEvent_RemovesSingleHandler() - { - // arrange - _bus.Register(); - _bus.Register(); - - // act - _bus.Unregister(); - - // assert - _channel.DidNotReceive().QueueUnbind(_options.ClientQueue, - _options.Exchange, - Arg.Any()); - } - - [Fact] - public void Publish_NotConnected_Connects() - { - // arrange - var message = new ConcreteEvent(@"{""foo"": ""bar""}"); - _connectionManager.IsConnected.Returns(false, true); - - // act - _bus.Publish(message); - - // assert - _connectionManager.Received().TryConnect(); - } - - [Fact] - public void Publish_Event_SendsMessage() - { - // act - var message = new ConcreteEvent("foo"); - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var timestamp = new DateTimeOffset(message.CreatedAt).ToUnixTimeMilliseconds(); - - // arrange - _bus.Publish(message); - - // assert - _channel.Received().BasicPublish(_options.Exchange, - message.Type, - true, - Arg.Is(x => - x.ContentType == "application/json" && - string.IsNullOrEmpty(x.ReplyTo) && - x.CorrelationId == message.CorrelationId && - x.Type == message.Type && - x.Persistent == true && - x.Timestamp.UnixTime == timestamp), - Arg.Is>(x => x.ToArray().SequenceEqual(body))); - } - - [Fact] - public async Task ReceiverHandler_RedeliveredEvent_SkipsMessage() - { - // act - var eventHandler = Substitute.For>(); - _scopeFactory.CreateScope().ServiceProvider.GetService(typeof(ConcreteSecondHandler)).Returns(eventHandler); - _bus.Register(); - - // arrange - await _basicConsumer.HandleBasicDeliver(default, default, true, default, default, default, default); - - // assert - await eventHandler.DidNotReceive().Handle(Arg.Any()); - } - - [Fact] - public async Task Execute_GivenCommand_SendsCommandToQueue() - { - // arrange - var command = new ConcreteCommand("foo", false); - var timestamp = new DateTimeOffset(command.CreatedAt).ToUnixTimeMilliseconds(); - var json = JsonSerializer.Serialize(command, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - - // act - var result = await _bus.Execute(command); - - // assert - result.Should().BeOfType(); - _channel.Received().BasicPublish("", - _options.AppQueue, - true, - Arg.Is(x => - x.ContentType == "application/json" && - x.ReplyTo == "amq.rabbitmq.reply-to" && - x.CorrelationId == command.CorrelationId && - x.Type == command.Type && - x.Persistent == true && - x.Timestamp.UnixTime == timestamp), - Arg.Is>(x => x.ToArray().SequenceEqual(body))); - } - - [Fact] - public async Task Execute_GivenCommand_SendsMessageToQueueAndGetsReply() - { - // arrange - var command = new ConcreteCommand2("foo"); - var reply = new FooBar("bar"); - var json = JsonSerializer.Serialize(reply, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteCommand2); - basicProperties.CorrelationId = command.CorrelationId; - - // act - var task = _bus.Execute(command); - await _replyConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - var result = await task; - - // assert - result.Should().BeOfType(); - } - - [Fact] - public async Task Execute_UsesSameChannelForBothPublishingAndConsuming() - { - // arrange - var command = new ConcreteCommand2("foo"); - var reply = new FooBar("bar"); - var json = JsonSerializer.Serialize(reply, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteCommand2); - basicProperties.CorrelationId = command.CorrelationId; - - // act - var task = _bus.Execute(command); - await _replyConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - await task; - - // assert - _connectionManager.Received(1).CreateChannel(); - } - - [Fact] - public async Task Execute_NoReplyForGivenTime_ThrowsError() - { - // arrange - var command = new ConcreteCommand2("foo", true, TimeSpan.FromMilliseconds(1)); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteCommand2); - basicProperties.CorrelationId = command.CorrelationId; - - // act - var act = () => _bus.Execute(command); - - // assert - await act.Should().ThrowAsync(); - } - - [Fact] - public async Task ReceiverHandler_InstanceOfHandlerNotFound_SkipsMessage() - { - // arrange - var message = new ConcreteEvent("foo"); - - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteEvent); - - var eventHandler = Substitute.For>(); - _bus.Register(); - - // act - await _basicConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - - // assert - await eventHandler.DidNotReceive().Handle(Arg.Any()); - } - - [Fact] - public async Task ReceiverHandler_SubscriptionNotFound_ThrowsError() - { - // arrange - var message = new ConcreteEvent("foo"); - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteEvent); - - // act - var act = () => _basicConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - - // assert - await act.Should().ThrowAsync(); - } - - [Fact] - public async Task ReceiverHandler_EventListenerThrowsError_SilentlyHandlesError() - { - // arrange - var message = new ConcreteEvent("foo"); - - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteEvent); - - var eventHandler = Substitute.For>(); - var exception = new Exception("something went wrong"); - eventHandler.Handle(Arg.Any()).ThrowsAsync(exception); - _scopeFactory.CreateScope().ServiceProvider.GetService(typeof(ConcreteSecondHandler)).Returns(eventHandler); - _bus.Register(); - - // act - var act = () => _basicConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - - // assert - await act.Should().NotThrowAsync(); - } - - [Fact] - public async Task ReceiverHandler_NewEvent_RoutesMessageByType() - { - // arrange - var message = new ConcreteEvent("foo"); - - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteEvent); - - var eventHandler = Substitute.For>(); - _scopeFactory.CreateScope().ServiceProvider.GetService(typeof(ConcreteSecondHandler)).Returns(eventHandler); - _bus.Register(); - - // act - await _basicConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - - // assert - await eventHandler.Received().Handle(Arg.Any()); - } - - [Fact] - public async Task ReceiverHandler_NewEvent_RoutesMessageByRoutingKey() - { - // arrange - var message = new ConcreteEvent("foo"); - - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - - var basicProperties = Substitute.For(); - - var eventHandler = Substitute.For>(); - _scopeFactory.CreateScope().ServiceProvider.GetService(typeof(ConcreteSecondHandler)).Returns(eventHandler); - _bus.Register(); - - // act - await _basicConsumer.HandleBasicDeliver(default, default, false, default, nameof(ConcreteEvent), basicProperties, body); - - // assert - await eventHandler.Received().Handle(Arg.Any()); - } - - [Fact] - public async Task ReceiverHandler_Reply_SendsReply() - { - // arrange - var message = new ConcreteEvent("foo"); - - var json = JsonSerializer.Serialize(message, JsonSerializerOptions); - var body = Encoding.UTF8.GetBytes(json); - - var basicProperties = Substitute.For(); - basicProperties.Type = nameof(ConcreteEvent); - basicProperties.ReplyTo = "reply"; - basicProperties.CorrelationId = "1"; - - var eventHandler = Substitute.For>(); - eventHandler.Handle(Arg.Any()).Returns(Task.FromResult(new FooBar("bar"))); - _scopeFactory.CreateScope().ServiceProvider.GetService(typeof(ConcreteFirstHandler)).Returns(eventHandler); - _bus.Register(); - - // act - await _basicConsumer.HandleBasicDeliver(default, default, false, default, default, basicProperties, body); - - // assert - await eventHandler.Received().Handle(Arg.Any()); - _channel.Received().BasicPublish("", - "reply", - true, - Arg.Is(x => - x.ContentType == "application/json" && - x.CorrelationId == "1" && - x.Persistent == true), - Arg.Any>()); - - } -} diff --git a/test/SecTester.Bus.Tests/Exceptions/EventHandlerNotFoundExceptionTests.cs b/test/SecTester.Bus.Tests/Exceptions/EventHandlerNotFoundExceptionTests.cs deleted file mode 100644 index dab4d53..0000000 --- a/test/SecTester.Bus.Tests/Exceptions/EventHandlerNotFoundExceptionTests.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace SecTester.Bus.Tests.Exceptions; - -public class EventHandlerNotFoundExceptionTests -{ - private const string DefaultPostfix = "Please register a handler for the following events"; - - [Fact] - public void EventHandlerNotFoundException_SingleEventName_CreatesInstance() - { - // arrange - const string eventName = "event1"; - - // act - var result = new EventHandlerNotFoundException(eventName); - - // assert - result.Should() - .Match(x => x.Message.EndsWith($"{DefaultPostfix}: {eventName}")); - } - - [Fact] - public void EventHandlerNotFoundException_MultipleEventNames_CreatesInstance() - { - // arrange - const string eventName = "event1"; - const string eventName2 = "event2"; - - // act - var result = new EventHandlerNotFoundException(eventName, eventName2); - - // assert - result.Should() - .Match(x => - x.Message.EndsWith($"{DefaultPostfix}: {string.Join(", ", eventName, eventName2)}")); - } -} diff --git a/test/SecTester.Bus.Tests/Exceptions/NoSubscriptionFoundException.cs b/test/SecTester.Bus.Tests/Exceptions/NoSubscriptionFoundException.cs deleted file mode 100644 index a55dfe3..0000000 --- a/test/SecTester.Bus.Tests/Exceptions/NoSubscriptionFoundException.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace SecTester.Bus.Tests.Exceptions; - -public class NoSubscriptionFoundExceptionTests -{ - [Fact] - public void NoSubscriptionFoundException_SingleEventName_CreatesInstance() - { - // arrange - const string eventName = "event1"; - - // act - var result = new NoSubscriptionFoundException(eventName); - - // assert - result.Should() - .Match(x => - x.Message.EndsWith($"Please register a handler for the {eventName} event in the event bus.")); - } -} diff --git a/test/SecTester.Bus.Tests/Extensions/GenericTypeExtensionsTests.cs b/test/SecTester.Bus.Tests/Extensions/GenericTypeExtensionsTests.cs deleted file mode 100644 index 2a78328..0000000 --- a/test/SecTester.Bus.Tests/Extensions/GenericTypeExtensionsTests.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SecTester.Bus.Tests.Fixtures; - -namespace SecTester.Bus.Tests.Extensions; - -public class GenericTypeExtensionsTests -{ - [Fact] - public void GetConcreteEventListenerType_ReturnTypeSpecified_ReturnsConcreteType() - { - // arrange - var type = typeof(ConcreteFirstHandler); - - // act - var result = type.GetConcreteEventListenerType(); - - // assert - result.Should().Be(typeof(IEventListener)); - } - - [Fact] - public void GetConcreteEventListenerType_ReturnTypeIsVoid_ReturnsConcreteType() - { - // arrange - var type = typeof(ConcreteSecondHandler); - - // act - var result = type.GetConcreteEventListenerType(); - - // assert - result.Should().Be(typeof(IEventListener)); - } -} diff --git a/test/SecTester.Bus.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Bus.Tests/Extensions/ServiceCollectionExtensionsTests.cs deleted file mode 100644 index 80ec841..0000000 --- a/test/SecTester.Bus.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace SecTester.Bus.Tests.Extensions; - -public class ServiceCollectionExtensionsTests -{ - private readonly ServiceCollection _services; - private readonly Configuration _config; - - public ServiceCollectionExtensionsTests() - { - _services = new ServiceCollection(); - _config = new Configuration("app.brightsec.com", - new Credentials("0zmcwpe.nexr.0vlon8mp7lvxzjuvgjy88olrhadhiukk")); - } - - [Fact] - public void AddSecTesterBus_ReturnHttpCommandDispatcherWithDefaultOptions() - { - // arrange - _services.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _services.AddSecTesterBus(); - - // assert - using var provider = _services.BuildServiceProvider(); - var result = provider.GetRequiredService(); - result.Should().BeOfType(); - } - - [Fact] - public void AddSecTesterBus_ReturnHttpCommandDispatcherConfig() - { - // arrange - _services.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _services.AddSecTesterBus(); - - // assert - using var provider = _services.BuildServiceProvider(); - var result = provider.GetRequiredService(); - result.Should().BeEquivalentTo(new - { - BaseUrl = _config.Api, - _config.Credentials!.Token - }); - } - - [Fact] - public void AddSecTesterBus_ReturnHttpClientWithPreconfiguredTimeout() - { - // arrange - _services.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _services.AddSecTesterBus(); - - // assert - using var provider = _services.BuildServiceProvider(); - var factory = provider.GetRequiredService(); - using var httpClient = factory.CreateClient(nameof(HttpCommandDispatcher)); - httpClient.Should().BeEquivalentTo(new - { - Timeout = TimeSpan.FromSeconds(10) - }); - } - - [Fact] - public void AddSecTesterBus_ConfigurationIsNotRegistered_ThrowError() - { - // act - _services.AddSecTesterBus(); - - // assert - using var provider = _services.BuildServiceProvider(); - Func act = () => provider.GetRequiredService(); - act.Should().Throw(); - } -} diff --git a/test/SecTester.Bus.Tests/Extensions/TaskExtensionsTests.cs b/test/SecTester.Bus.Tests/Extensions/TaskExtensionsTests.cs deleted file mode 100644 index 2b57a82..0000000 --- a/test/SecTester.Bus.Tests/Extensions/TaskExtensionsTests.cs +++ /dev/null @@ -1,74 +0,0 @@ -using SecTester.Bus.Tests.Fixtures; - -namespace SecTester.Bus.Tests.Extensions; - -public class TaskExtensionsTests -{ - [Fact] - public void Cast_CastedToObjectReturnType_ReturnsCasted() - { - // arrange - var task = Task.FromResult(new FooBar("bar")); - - // act - var result = task.Cast(); - - // assert - result.Should().BeOfType(typeof(Task)); - } - - [Fact] - public void Cast_ObjectReturnType_ReturnsCasted() - { - // arrange - var task = Task.FromResult(new - { - Foo = "bar" - }); - - // act - var result = task.Cast(); - - // assert - result.Should().BeOfType(typeof(Task)); - } - - [Fact] - public void Cast_GenericReturnType_ReturnsCastedToObject() - { - // arrange - var task = Task.FromResult(new FooBar("bar")); - - // act - var result = task.Cast(); - - // assert - result.Should().BeOfType(typeof(Task)); - } - - [Fact] - public void Cast_NullPassed_ThrowsException() - { - // arrange - var task = null as Task; - - // act - var act = () => task!.Cast(); - - // assert - act.Should().ThrowAsync().WithMessage("*task*"); - } - - [Fact] - public void Cast_NonGenericReturnType_ThrowsException() - { - // arrange - var task = Task.CompletedTask; - - // act - var act = () => task.Cast(); - - // assert - act.Should().ThrowAsync().WithMessage("An argument of type 'Task' was expected"); - } -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent.cs deleted file mode 100644 index 8c1b759..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -internal record ConcreteEvent(string Payload) : Event -{ - public string Payload = Payload; -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent2.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent2.cs deleted file mode 100644 index 47cc929..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent2.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -[MessageType(name: nameof(ConcreteEvent))] -internal record ConcreteEvent2(string Payload) : Event -{ - public string Payload = Payload; -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent3.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent3.cs deleted file mode 100644 index 14c0e0c..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteEvent3.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -[MessageType(name: "custom")] -internal record ConcreteEvent3(string Payload) : Event -{ - public string Payload = Payload; -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteFirstHandler.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteFirstHandler.cs deleted file mode 100644 index e2eacf7..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteFirstHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -internal class ConcreteFirstHandler : IEventListener -{ - public Task Handle(ConcreteEvent message) - { - return Task.FromResult(new FooBar("bar")); - } -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteSecondHandler.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteSecondHandler.cs deleted file mode 100644 index ce55263..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteSecondHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -internal class ConcreteSecondHandler : IEventListener -{ - public Task Handle(ConcreteEvent message) - { - return Unit.Task; - } -} diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteThirdHandler.cs b/test/SecTester.Bus.Tests/Fixtures/ConcreteThirdHandler.cs deleted file mode 100644 index 116070a..0000000 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteThirdHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SecTester.Bus.Tests.Fixtures; - -internal class ConcreteThirdHandler : IEventListener -{ - public Task Handle(ConcreteEvent2 message) - { - return Unit.Task; - } -} diff --git a/test/SecTester.Bus.Tests/SecTester.Bus.Tests.csproj b/test/SecTester.Bus.Tests/SecTester.Bus.Tests.csproj deleted file mode 100644 index 36ff61e..0000000 --- a/test/SecTester.Bus.Tests/SecTester.Bus.Tests.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net6.0 - - - - - - - - - - - - - - - - - - diff --git a/test/SecTester.Bus.Tests/Usings.cs b/test/SecTester.Bus.Tests/Usings.cs deleted file mode 100644 index dc99947..0000000 --- a/test/SecTester.Bus.Tests/Usings.cs +++ /dev/null @@ -1,29 +0,0 @@ -global using System; -global using System.Linq; -global using System.Net; -global using System.Net.Http; -global using System.Net.Http.Json; -global using System.Net.Sockets; -global using System.Text; -global using System.Text.Json; -global using System.Text.Json.Serialization; -global using System.Threading.Tasks; -global using FluentAssertions; -global using Microsoft.Extensions.DependencyInjection; -global using Microsoft.Extensions.DependencyInjection.Extensions; -global using Microsoft.Extensions.Logging; -global using NSubstitute; -global using NSubstitute.ClearExtensions; -global using NSubstitute.ExceptionExtensions; -global using RabbitMQ.Client; -global using RabbitMQ.Client.Events; -global using RabbitMQ.Client.Exceptions; -global using RichardSzalay.MockHttp; -global using SecTester.Bus.Commands; -global using SecTester.Bus.Dispatchers; -global using SecTester.Bus.Exceptions; -global using SecTester.Bus.Extensions; -global using SecTester.Bus.RetryStrategies; -global using SecTester.Core; -global using SecTester.Core.Bus; -global using Xunit; diff --git a/test/SecTester.Bus.Tests/packages.lock.json b/test/SecTester.Bus.Tests/packages.lock.json deleted file mode 100644 index a2f68df..0000000 --- a/test/SecTester.Bus.Tests/packages.lock.json +++ /dev/null @@ -1,1372 +0,0 @@ -{ - "version": 1, - "dependencies": { - "net6.0": { - "coverlet.collector": { - "type": "Direct", - "requested": "[3.1.2, )", - "resolved": "3.1.2", - "contentHash": "wuLDIDKD5XMt0A7lE31JPenT7QQwZPFkP5rRpdJeblyXZ9MGLI8rYjvm5fvAKln+2/X+4IxxQDxBtwdrqKNLZw==" - }, - "coverlet.msbuild": { - "type": "Direct", - "requested": "[3.2.0, )", - "resolved": "3.2.0", - "contentHash": "lu/eJJpqJb4qy3BGPtDD/LI5RSOwXYYyRErTyaG0OTP69llzVK3FEe74hBQx0JtLUTLEVBfERV4uGYcE1Br2sg==" - }, - "FluentAssertions": { - "type": "Direct", - "requested": "[6.8.0, )", - "resolved": "6.8.0", - "contentHash": "NfSlAG97wMxS48Ov+wQEhJITdn4bKrgtKrG4sCPrFBVKozpC57lQ2vzsPdxUOsPbfEgEQTMtvCDECxIlDBfgNA==", - "dependencies": { - "System.Configuration.ConfigurationManager": "4.4.0" - } - }, - "Microsoft.Extensions.DependencyInjection": { - "type": "Direct", - "requested": "[6.0.1, )", - "resolved": "6.0.1", - "contentHash": "vWXPg3HJQIpZkENn1KWq8SfbqVujVD7S7vIAyFXXqK5xkf1Vho+vG0bLBCHxU36lD1cLLtmGpfYf0B3MYFi9tQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.NET.Test.Sdk": { - "type": "Direct", - "requested": "[17.1.0, )", - "resolved": "17.1.0", - "contentHash": "MVKvOsHIfrZrvg+8aqOF5dknO/qWrR1sWZjMPQ1N42MKMlL/zQL30FQFZxPeWfmVKWUWAOmAHYsqB5OerTKziw==", - "dependencies": { - "Microsoft.CodeCoverage": "17.1.0", - "Microsoft.TestPlatform.TestHost": "17.1.0" - } - }, - "NSubstitute": { - "type": "Direct", - "requested": "[4.4.0, )", - "resolved": "4.4.0", - "contentHash": "aArWp0M9n/3IZHCNSb3QIHy0tkPLSft8l3KFeUa54GbznKiv0FE687TBfPhZbXf0/zGtc4EsHLEUqEEf0Bf4HQ==", - "dependencies": { - "Castle.Core": "5.0.0" - } - }, - "RichardSzalay.MockHttp": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "bStGNqIX/MGYtML7K3EzdsE/k5HGVAcg7XgN23TQXGXqxNC9fvYFR94fA0sGM5hAT36R+BBGet6ZDQxXL/IPxg==" - }, - "xunit": { - "type": "Direct", - "requested": "[2.4.1, )", - "resolved": "2.4.1", - "contentHash": "XNR3Yz9QTtec16O0aKcO6+baVNpXmOnPUxDkCY97J+8krUYxPvXT1szYYEUdKk4sB8GOI2YbAjRIOm8ZnXRfzQ==", - "dependencies": { - "xunit.analyzers": "0.10.0", - "xunit.assert": "[2.4.1]", - "xunit.core": "[2.4.1]" - } - }, - "xunit.runner.visualstudio": { - "type": "Direct", - "requested": "[2.4.3, )", - "resolved": "2.4.3", - "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" - }, - "Castle.Core": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "edc8jjyXqzzy8jFdhs36FZdwmlDDTgqPb2Zy1Q5F/f2uAc88bu/VS/0Tpvgupmpl9zJOvOo5ZizVANb0ltN1NQ==", - "dependencies": { - "System.Diagnostics.EventLog": "6.0.0" - } - }, - "Macross.Json.Extensions": { - "type": "Transitive", - "resolved": "3.0.0", - "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==" - }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==" - }, - "Microsoft.CodeCoverage": { - "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ==" - }, - "Microsoft.CSharp": { - "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - } - }, - "Microsoft.Extensions.Configuration": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "tq2wXyh3fL17EMF2bXgRhU7JrbO3on93MRKYxzz4JzzvuGSA1l0W3GI9/tl8EO89TH+KWEymP7bcFway6z9fXg==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Configuration.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "qWzV9o+ZRWq+pGm+1dF+R7qTgTYoXvbyowRoBxQJGfqTpqDun2eteerjRQhq5PQ/14S+lqto3Ft4gYaRyl4rdQ==", - "dependencies": { - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Configuration.Binder": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "b3ErKzND8LIC7o08QAVlKfaEIYEvLJbtmVbFZVBRXeu9YkKfSSzLZfR1SUfQPBIy9mKLhEtJgGYImkcMNaKE0A==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0" - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" - }, - "Microsoft.Extensions.Http": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0" - } - }, - "Microsoft.Extensions.Logging": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "System.Diagnostics.DiagnosticSource": "6.0.0" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==" - }, - "Microsoft.Extensions.Logging.Configuration": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "ZDskjagmBAbv+K8rYW9VhjPplhbOE63xUD0DiuydZJwt15dRyoqicYklLd86zzeintUc7AptDkHn+YhhYkYo8A==", - "dependencies": { - "Microsoft.Extensions.Configuration": "6.0.0", - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Configuration.Binder": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "Microsoft.Extensions.Options.ConfigurationExtensions": "6.0.0" - } - }, - "Microsoft.Extensions.Logging.Console": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "gsqKzOEdsvq28QiXFxagmn1oRB9GeI5GgYCkoybZtQA0IUb7QPwf1WmN3AwJeNIsadTvIFQCiVK0OVIgKfOBGg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging.Configuration": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "System.Text.Json": "6.0.0" - } - }, - "Microsoft.Extensions.Options": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Options.ConfigurationExtensions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "bXWINbTn0vC0FYc9GaQTISbxhQLAMrvtbuvD9N6JelEaIS/Pr62wUCinrq5bf1WRBGczt1v4wDhxFtVFNcMdUQ==", - "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", - "Microsoft.Extensions.Configuration.Binder": "6.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0", - "Microsoft.Extensions.Primitives": "6.0.0" - } - }, - "Microsoft.Extensions.Primitives": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - }, - "Microsoft.NETCore.Targets": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" - }, - "Microsoft.TestPlatform.ObjectModel": { - "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "OMo/FYnKGy3lZEK0gfitskRM3ga/YBt6MyCyFPq0xNLeybGOQ6HnYNAAvzyePo5WPuMiw3LX+HiuRWNjnas1fA==", - "dependencies": { - "NuGet.Frameworks": "5.11.0", - "System.Reflection.Metadata": "1.6.0" - } - }, - "Microsoft.TestPlatform.TestHost": { - "type": "Transitive", - "resolved": "17.1.0", - "contentHash": "JS0JDLniDhIzkSPLHz7N/x1CG8ywJOtwInFDYA3KQvbz+ojGoT5MT2YDVReL1b86zmNRV8339vsTSm/zh0RcMg==", - "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.1.0", - "Newtonsoft.Json": "9.0.1" - } - }, - "Microsoft.Win32.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "NETStandard.Library": { - "type": "Transitive", - "resolved": "1.6.1", - "contentHash": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "9.0.1", - "contentHash": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - } - }, - "NuGet.Frameworks": { - "type": "Transitive", - "resolved": "5.11.0", - "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" - }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==" - }, - "runtime.native.System": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" - }, - "System.AppContext": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Collections": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Collections.Concurrent": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Configuration.ConfigurationManager": { - "type": "Transitive", - "resolved": "4.4.0", - "contentHash": "gWwQv/Ug1qWJmHCmN17nAbxJYmQBM/E94QxKLksvUiiKB1Ld3Sc/eK1lgmbSjDFxkQhVuayI/cGFZhpBSodLrg==", - "dependencies": { - "System.Security.Cryptography.ProtectedData": "4.4.0" - } - }, - "System.Console": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Diagnostics.Debug": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Diagnostics.EventLog": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "lcyUiXTsETK2ALsZrX+nWuHSIQeazhqPphLfaRxzdGaG93+0kELqpgEHtwWOlQe7+jSFnKwaCAgL4kjeZCQJnw==" - }, - "System.Diagnostics.Tools": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.Tracing": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Dynamic.Runtime": { - "type": "Transitive", - "resolved": "4.0.11", - "contentHash": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - } - }, - "System.Globalization": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Calendars": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - } - }, - "System.IO": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - } - }, - "System.IO.Compression.ZipFile": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.IO.FileSystem": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.FileSystem.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Linq": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Linq.Async": { - "type": "Transitive", - "resolved": "6.0.1", - "contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0" - } - }, - "System.Linq.Expressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Memory": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" - }, - "System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Net.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Net.Sockets": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.ObjectModel": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Reflection": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.ILGeneration": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.Lightweight": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Metadata": { - "type": "Transitive", - "resolved": "1.6.0", - "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" - }, - "System.Reflection.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.TypeExtensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Resources.ResourceManager": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" - }, - "System.Runtime.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.Handles": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.InteropServices": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Runtime.InteropServices.RuntimeInformation": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, - "System.Runtime.Numerics": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Runtime.Serialization.Primitives": { - "type": "Transitive", - "resolved": "4.1.1", - "contentHash": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - } - }, - "System.Security.Cryptography.Algorithms": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Cng": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Security.Cryptography.Csp": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Security.Cryptography.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Security.Cryptography.ProtectedData": { - "type": "Transitive", - "resolved": "4.4.0", - "contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog==" - }, - "System.Security.Cryptography.X509Certificates": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Text.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Text.Encoding.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" - } - }, - "System.Text.RegularExpressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==" - }, - "System.Threading.RateLimiting": { - "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==" - }, - "System.Threading.Tasks": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Timer": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Xml.ReaderWriter": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - } - }, - "System.Xml.XDocument": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - } - }, - "xunit.abstractions": { - "type": "Transitive", - "resolved": "2.0.3", - "contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==" - }, - "xunit.analyzers": { - "type": "Transitive", - "resolved": "0.10.0", - "contentHash": "4/IDFCJfIeg6bix9apmUtIMwvOsiwqdEexeO/R2D4GReIGPLIRODTpId/l4LRSrAJk9lEO3Zx1H0Zx6uohJDNg==" - }, - "xunit.assert": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "O/Oe0BS5RmSsM+LQOb041TzuPo5MdH2Rov+qXGS37X+KFG1Hxz7kopYklM5+1Y+tRGeXrOx5+Xne1RuqLFQoyQ==", - "dependencies": { - "NETStandard.Library": "1.6.1" - } - }, - "xunit.core": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "Zsj5OMU6JasNGERXZy8s72+pcheG6Q15atS5XpZXqAtULuyQiQ6XNnUsp1gyfC6WgqScqMvySiEHmHcOG6Eg0Q==", - "dependencies": { - "xunit.extensibility.core": "[2.4.1]", - "xunit.extensibility.execution": "[2.4.1]" - } - }, - "xunit.extensibility.core": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "yKZKm/8QNZnBnGZFD9SewkllHBiK0DThybQD/G4PiAmQjKtEZyHi6ET70QPU9KtSMJGRYS6Syk7EyR2EVDU4Kg==", - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.abstractions": "2.0.3" - } - }, - "xunit.extensibility.execution": { - "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "7e/1jqBpcb7frLkB6XDrHCGXAbKN4Rtdb88epYxCSRQuZDRW8UtTfdTEVpdTl8s4T56e07hOBVd4G0OdCxIY2A==", - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.4.1]" - } - }, - "sectester.bus": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" - } - }, - "sectester.core": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" - } - }, - "sectester.scan": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.40.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" - } - } - } - } -} \ No newline at end of file diff --git a/test/SecTester.Core.Tests/Bus/EventTests.cs b/test/SecTester.Core.Tests/Bus/EventTests.cs deleted file mode 100644 index f302a87..0000000 --- a/test/SecTester.Core.Tests/Bus/EventTests.cs +++ /dev/null @@ -1,49 +0,0 @@ -using SecTester.Core.Tests.Fixtures; - -namespace SecTester.Core.Tests.Bus; - -public class EventTests : IDisposable -{ - private readonly IEventDispatcher _dispatcher; - - public EventTests() - { - _dispatcher = Substitute.For(); - } - - public void Dispose() - { - _dispatcher.ClearSubstitute(); - GC.SuppressFinalize(this); - } - - [Fact] - public void Event_Publishes() - { - // arrange - const string payload = "text"; - var @event = new TestEvent(Payload: payload); - _dispatcher.Publish(@event).Returns(Task.CompletedTask); - - // act - @event.Publish(_dispatcher); - - // assert - _dispatcher.Received(1).Publish(@event); - } - - [Fact] - public void Command_WhenException_RethrowsError() - { - // arrange - const string payload = "text"; - var @event = new TestEvent(Payload: payload); - _dispatcher.Publish(@event).ThrowsAsync(); - - // act - var act = () => @event.Publish(_dispatcher); - - // assert - act.Should().ThrowAsync(); - } -} diff --git a/test/SecTester.Core.Tests/Bus/MessageTypeAttributeTests.cs b/test/SecTester.Core.Tests/Bus/MessageTypeAttributeTests.cs index 2636a95..e2fbd5d 100644 --- a/test/SecTester.Core.Tests/Bus/MessageTypeAttributeTests.cs +++ b/test/SecTester.Core.Tests/Bus/MessageTypeAttributeTests.cs @@ -8,7 +8,7 @@ public class MessageTypeAttributeTests public void EventNameAttribute_SetsCustomName() { // arrange - var info = typeof(TestEvent2); + var info = typeof(TestMessage2); // act var attribute = info.GetCustomAttributes(typeof(MessageTypeAttribute), true).FirstOrDefault(); diff --git a/test/SecTester.Core.Tests/ConfigurationTests.cs b/test/SecTester.Core.Tests/ConfigurationTests.cs index 3fa7ddd..8e4d9a4 100644 --- a/test/SecTester.Core.Tests/ConfigurationTests.cs +++ b/test/SecTester.Core.Tests/ConfigurationTests.cs @@ -4,20 +4,20 @@ public class ConfigurationTests { public static IEnumerable Hostnames => new List { - new object[] { "localhost", new { Bus = "amqp://localhost:5672", Api = "http://localhost:8000" } }, - new object[] { "localhost:8080", new { Bus = "amqp://localhost:5672", Api = "http://localhost:8000" } }, - new object[] { "http://localhost", new { Bus = "amqp://localhost:5672", Api = "http://localhost:8000" } }, - new object[] { "http://localhost:8080", new { Bus = "amqp://localhost:5672", Api = "http://localhost:8000" } }, - new object[] { "127.0.0.1", new { Bus = "amqp://127.0.0.1:5672", Api = "http://127.0.0.1:8000" } }, - new object[] { "127.0.0.1:8080", new { Bus = "amqp://127.0.0.1:5672", Api = "http://127.0.0.1:8000" } }, - new object[] { "http://127.0.0.1", new { Bus = "amqp://127.0.0.1:5672", Api = "http://127.0.0.1:8000" } }, - new object[] { "http://127.0.0.1:8080", new { Bus = "amqp://127.0.0.1:5672", Api = "http://127.0.0.1:8000" } }, - new object[] { "example.com", new { Bus = "amqps://amq.example.com:5672", Api = "https://example.com" } }, - new object[] { "example.com:443", new { Bus = "amqps://amq.example.com:5672", Api = "https://example.com" } }, - new object[] { "http://example.com", new { Bus = "amqps://amq.example.com:5672", Api = "https://example.com" } }, + new object[] { "localhost", new { Api = "http://localhost:8000" } }, + new object[] { "localhost:8080", new { Api = "http://localhost:8000" } }, + new object[] { "http://localhost", new { Api = "http://localhost:8000" } }, + new object[] { "http://localhost:8080", new { Api = "http://localhost:8000" } }, + new object[] { "127.0.0.1", new { Api = "http://127.0.0.1:8000" } }, + new object[] { "127.0.0.1:8080", new { Api = "http://127.0.0.1:8000" } }, + new object[] { "http://127.0.0.1", new { Api = "http://127.0.0.1:8000" } }, + new object[] { "http://127.0.0.1:8080", new { Api = "http://127.0.0.1:8000" } }, + new object[] { "example.com", new { Api = "https://example.com" } }, + new object[] { "example.com:443", new { Api = "https://example.com" } }, + new object[] { "http://example.com", new { Api = "https://example.com" } }, new object[] { - "http://example.com:443", new { Bus = "amqps://amq.example.com:5672", Api = "https://example.com" } + "http://example.com:443", new { Api = "https://example.com" } } }; diff --git a/test/SecTester.Core.Tests/Fixtures/TestEvent.cs b/test/SecTester.Core.Tests/Fixtures/TestEvent.cs deleted file mode 100644 index d606a50..0000000 --- a/test/SecTester.Core.Tests/Fixtures/TestEvent.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace SecTester.Core.Tests.Fixtures; - -internal record TestEvent(string Payload) : Event -{ - public string Payload = Payload; -} diff --git a/test/SecTester.Core.Tests/Fixtures/TestEvent2.cs b/test/SecTester.Core.Tests/Fixtures/TestEvent2.cs deleted file mode 100644 index f18b9eb..0000000 --- a/test/SecTester.Core.Tests/Fixtures/TestEvent2.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace SecTester.Core.Tests.Fixtures; - -[MessageType(name: "custom")] -internal record TestEvent2 : Event; diff --git a/test/SecTester.Core.Tests/Fixtures/TestMessage2.cs b/test/SecTester.Core.Tests/Fixtures/TestMessage2.cs new file mode 100644 index 0000000..cc4b8e6 --- /dev/null +++ b/test/SecTester.Core.Tests/Fixtures/TestMessage2.cs @@ -0,0 +1,17 @@ +namespace SecTester.Core.Tests.Fixtures; + +[MessageType("custom")] +internal record TestMessage2 : Message +{ + public string Payload { get; } + + public TestMessage2(string payload) + { + Payload = payload; + } + + public TestMessage2(string payload, string type, string correlationId, DateTime createdAt) : base(type, correlationId, createdAt) + { + Payload = payload; + } +} diff --git a/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj b/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj index 17a47c6..34a7484 100644 --- a/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj +++ b/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj @@ -12,7 +12,6 @@ - diff --git a/test/SecTester.Core.Tests/Utils/MessageUtilsTests.cs b/test/SecTester.Core.Tests/Utils/MessageUtilsTests.cs index e927194..6f6de99 100644 --- a/test/SecTester.Core.Tests/Utils/MessageUtilsTests.cs +++ b/test/SecTester.Core.Tests/Utils/MessageUtilsTests.cs @@ -8,11 +8,11 @@ public class MessageUtilsTests { new object[] { - typeof(TestEvent), nameof(TestEvent) + typeof(TestMessage), nameof(TestMessage) }, new object[] { - typeof(TestEvent2), "custom" + typeof(TestMessage2), "custom" } }; @@ -31,17 +31,17 @@ public void MessageUtils_GivenType_ReturnsType(Type input, string expected) public void MessageUtils_GivenGenericType_ReturnsType() { // act - var result = MessageUtils.GetMessageType(); + var result = MessageUtils.GetMessageType(); // assert - result.Should().Be("TestEvent"); + result.Should().Be("TestMessage"); } [Fact] public void MessageUtils_GivenGenericTypeWithAttribute_ReturnsType() { // act - var result = MessageUtils.GetMessageType(); + var result = MessageUtils.GetMessageType(); // assert result.Should().Be("custom"); diff --git a/test/SecTester.Bus.Tests/Dispatchers/HttpCommandDispatcherTests.cs b/test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs similarity index 98% rename from test/SecTester.Bus.Tests/Dispatchers/HttpCommandDispatcherTests.cs rename to test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs index e277925..dbfc6ef 100644 --- a/test/SecTester.Bus.Tests/Dispatchers/HttpCommandDispatcherTests.cs +++ b/test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs @@ -1,6 +1,6 @@ -using SecTester.Bus.Tests.Fixtures; +using SecTester.Repeater.Tests.Fixtures; -namespace SecTester.Bus.Tests.Dispatchers; +namespace SecTester.Repeater.Tests.Dispatchers; public class HttpCommandDispatcherTests : IDisposable { diff --git a/test/SecTester.Bus.Tests/Dispatchers/MessageSerializerTests.cs b/test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs similarity index 98% rename from test/SecTester.Bus.Tests/Dispatchers/MessageSerializerTests.cs rename to test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs index e6065ef..68793bf 100644 --- a/test/SecTester.Bus.Tests/Dispatchers/MessageSerializerTests.cs +++ b/test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs @@ -1,7 +1,7 @@ -using SecTester.Bus.Tests.Fixtures; +using SecTester.Repeater.Tests.Fixtures; using SecTester.Scan.Models; -namespace SecTester.Bus.Tests.Dispatchers; +namespace SecTester.Repeater.Tests.Dispatchers; public class MessageSerializerTests { @@ -24,8 +24,7 @@ public class MessageSerializerTests public static readonly IEnumerable ProtocolEnumerable = new List { - new object[] { Protocol.Http, @"""http""" }, - new object[] { Protocol.Ws, @"""ws""" } + new object[] { Protocol.Http, @"""http""" } }; public static readonly IEnumerable DiscoveryEnumerable = new List diff --git a/test/SecTester.Bus.Tests/Extensions/HttpResponseMessageExtensionsTests.cs b/test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs similarity index 96% rename from test/SecTester.Bus.Tests/Extensions/HttpResponseMessageExtensionsTests.cs rename to test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs index 23b249a..768ca8c 100644 --- a/test/SecTester.Bus.Tests/Extensions/HttpResponseMessageExtensionsTests.cs +++ b/test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Extensions; +namespace SecTester.Repeater.Tests.Extensions; public class HttpResponseMessageExtensionsTests { @@ -65,7 +65,7 @@ public class HttpResponseMessageExtensionsTests [MemberData(nameof(SucceededStatusCodes))] public async Task ThrowIfUnsuccessful_SuccessfulStatusCode_NotThrows(HttpStatusCode httpStatusCode) { - // arrange + // arrange var message = new HttpResponseMessage(httpStatusCode); // act @@ -79,7 +79,7 @@ public async Task ThrowIfUnsuccessful_SuccessfulStatusCode_NotThrows(HttpStatusC [MemberData(nameof(UnsuccessfulStatusCodes))] public async Task ThrowIfUnsuccessful_UnsuccessfulStatusCode_ThrowsDefaultError(HttpStatusCode httpStatusCode) { - // arrange + // arrange var message = new HttpResponseMessage(httpStatusCode); // act @@ -93,7 +93,7 @@ public async Task ThrowIfUnsuccessful_UnsuccessfulStatusCode_ThrowsDefaultError( [MemberData(nameof(ExpectedConditions))] public async Task ThrowIfUnsuccessful_UnsuccessfulStatusCodeWithErrorMessage_ThrowsError(string contentType, string content) { - // arrange + // arrange var message = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(content, Encoding.UTF8, contentType) @@ -111,7 +111,7 @@ await act.Should().ThrowAsync().WithMessage( [MemberData(nameof(NonExpectedConditions))] public async Task ThrowIfUnsuccessful_UnsuccessfulStatusCodeWithErrorMessage_ThrowsDefaultError(string contentType, string content) { - // arrange + // arrange var message = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(content, Encoding.UTF8, contentType) diff --git a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs index 91e4b39..ece222d 100644 --- a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -3,6 +3,8 @@ namespace SecTester.Repeater.Tests.Extensions; public class ServiceCollectionExtensionsTests : IDisposable { private readonly ServiceCollection _sut = Substitute.ForPartsOf(); + private readonly Configuration _config = new("app.brightsec.com", + new Credentials("0zmcwpe.nexr.0vlon8mp7lvxzjuvgjy88olrhadhiukk")); public void Dispose() { @@ -124,4 +126,69 @@ public void AddSecTesterRepeater_WithExtraHeaders_RegistersHttpClient() client.DefaultRequestHeaders.Should().BeEquivalentTo(headers); } + + [Fact] + public void AddSecTesterRepeater_ReturnHttpCommandDispatcherWithDefaultOptions() + { + // arrange + _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); + + // act + _sut.AddSecTesterRepeater(); + + // assert + using var provider = _sut.BuildServiceProvider(); + var result = provider.GetRequiredService(); + result.Should().BeOfType(); + } + + [Fact] + public void AddSecTesterRepeater_ReturnHttpCommandDispatcherConfig() + { + // arrange + _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); + + // act + _sut.AddSecTesterRepeater(); + + // assert + using var provider = _sut.BuildServiceProvider(); + var result = provider.GetRequiredService(); + result.Should().BeEquivalentTo(new + { + BaseUrl = _config.Api, + _config.Credentials!.Token + }); + } + + [Fact] + public void AddSecTesterRepeater_ReturnHttpClientWithPreconfiguredTimeout() + { + // arrange + _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); + + // act + _sut.AddSecTesterRepeater(); + + // assert + using var provider = _sut.BuildServiceProvider(); + var factory = provider.GetRequiredService(); + using var httpClient = factory.CreateClient(nameof(HttpCommandDispatcher)); + httpClient.Should().BeEquivalentTo(new + { + Timeout = TimeSpan.FromSeconds(10) + }); + } + + [Fact] + public void AddSecTesterRepeater_ConfigurationIsNotRegistered_ThrowError() + { + // act + _sut.AddSecTesterRepeater(); + + // assert + using var provider = _sut.BuildServiceProvider(); + Func act = () => provider.GetRequiredService(); + act.Should().Throw(); + } } diff --git a/test/SecTester.Bus.Tests/Fixtures/BazQux.cs b/test/SecTester.Repeater.Tests/Fixtures/BazQux.cs similarity index 74% rename from test/SecTester.Bus.Tests/Fixtures/BazQux.cs rename to test/SecTester.Repeater.Tests/Fixtures/BazQux.cs index 3890934..86dad1d 100644 --- a/test/SecTester.Bus.Tests/Fixtures/BazQux.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/BazQux.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal record BazQux { diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteCommand.cs b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs similarity index 83% rename from test/SecTester.Bus.Tests/Fixtures/ConcreteCommand.cs rename to test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs index b43c8e4..4a50649 100644 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteCommand.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal record ConcreteCommand : Command { diff --git a/test/SecTester.Bus.Tests/Fixtures/ConcreteCommand2.cs b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs similarity index 83% rename from test/SecTester.Bus.Tests/Fixtures/ConcreteCommand2.cs rename to test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs index 26a25a8..2624188 100644 --- a/test/SecTester.Bus.Tests/Fixtures/ConcreteCommand2.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal record ConcreteCommand2 : Command { diff --git a/test/SecTester.Bus.Tests/Fixtures/FooBar.cs b/test/SecTester.Repeater.Tests/Fixtures/FooBar.cs similarity index 74% rename from test/SecTester.Bus.Tests/Fixtures/FooBar.cs rename to test/SecTester.Repeater.Tests/Fixtures/FooBar.cs index 1c0bcdf..8288146 100644 --- a/test/SecTester.Bus.Tests/Fixtures/FooBar.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/FooBar.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal record FooBar { diff --git a/test/SecTester.Bus.Tests/Fixtures/FooBaz.cs b/test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs similarity index 66% rename from test/SecTester.Bus.Tests/Fixtures/FooBaz.cs rename to test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs index 326b617..4982ee6 100644 --- a/test/SecTester.Bus.Tests/Fixtures/FooBaz.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs @@ -1,3 +1,3 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal record FooBaz(IEnumerable>> Headers); diff --git a/test/SecTester.Bus.Tests/Fixtures/FooEnum.cs b/test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs similarity index 73% rename from test/SecTester.Bus.Tests/Fixtures/FooEnum.cs rename to test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs index 5bed6f8..48aa861 100644 --- a/test/SecTester.Bus.Tests/Fixtures/FooEnum.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal enum FooEnum { diff --git a/test/SecTester.Bus.Tests/Fixtures/IMockInterface.cs b/test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs similarity index 61% rename from test/SecTester.Bus.Tests/Fixtures/IMockInterface.cs rename to test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs index 25faf5b..3da1889 100644 --- a/test/SecTester.Bus.Tests/Fixtures/IMockInterface.cs +++ b/test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs @@ -1,4 +1,4 @@ -namespace SecTester.Bus.Tests.Fixtures; +namespace SecTester.Repeater.Tests.Fixtures; internal interface IMockInterface { diff --git a/test/SecTester.Bus.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs b/test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs similarity index 93% rename from test/SecTester.Bus.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs rename to test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs index d7fedea..8a90e66 100644 --- a/test/SecTester.Bus.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs +++ b/test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs @@ -1,6 +1,6 @@ -using SecTester.Bus.Tests.Fixtures; +using SecTester.Repeater.Tests.Fixtures; -namespace SecTester.Bus.Tests.RetryStrategies; +namespace SecTester.Repeater.Tests.RetryStrategies; public class ExponentialBackoffRetryStrategyTests : IDisposable { @@ -101,8 +101,7 @@ public static IEnumerable Exceptions { var list = new List { - new object[] { new SocketException() }, - new object[] { new BrokerUnreachableException(new Exception("something went wrong")) } + new object[] { new SocketException() } }; list.AddRange(Enumerable.Repeat(500, 12).Select(x => new[] { diff --git a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj index 0a9fc3e..74187c4 100644 --- a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj +++ b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj @@ -6,12 +6,13 @@ + - + diff --git a/test/SecTester.Repeater.Tests/Usings.cs b/test/SecTester.Repeater.Tests/Usings.cs index 5030788..2fe5b6c 100644 --- a/test/SecTester.Repeater.Tests/Usings.cs +++ b/test/SecTester.Repeater.Tests/Usings.cs @@ -1,7 +1,10 @@ global using System.Net; global using System.Net.Sockets; +global using System.Net.Http.Json; global using System.Net.WebSockets; global using System.Text; +global using System.Text.Json; +global using System.Text.Json.Serialization; global using System.Text.RegularExpressions; global using System.Timers; global using FluentAssertions; @@ -11,6 +14,7 @@ global using Microsoft.AspNetCore.Mvc.Testing; global using Microsoft.AspNetCore.TestHost; global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.DependencyInjection.Extensions; global using Microsoft.Extensions.Logging; global using NSubstitute; global using NSubstitute.ClearExtensions; @@ -27,4 +31,9 @@ global using SecTester.Repeater.Extensions; global using SecTester.Repeater.Runners; global using SecTester.Repeater.Tests.Mocks; +global using SecTester.Repeater.Commands; +global using SecTester.Repeater.Dispatchers; +global using SecTester.Repeater.Exceptions; +global using SecTester.Repeater.RetryStrategies; global using Xunit; + diff --git a/test/SecTester.Repeater.Tests/packages.lock.json b/test/SecTester.Repeater.Tests/packages.lock.json index 4765948..c514f5c 100644 --- a/test/SecTester.Repeater.Tests/packages.lock.json +++ b/test/SecTester.Repeater.Tests/packages.lock.json @@ -564,15 +564,6 @@ "resolved": "5.11.0", "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", @@ -1455,11 +1446,6 @@ "System.Threading.Tasks": "4.3.0" } }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==" - }, "System.Threading.RateLimiting": { "type": "Transitive", "resolved": "7.0.0", @@ -1581,19 +1567,6 @@ "xunit.extensibility.core": "[2.4.1]" } }, - "sectester.bus": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.41.3, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" - } - }, "sectester.core": { "type": "Project", "dependencies": { @@ -1605,11 +1578,25 @@ "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.41.3, )", - "SecTester.Core": "[0.41.3, )", + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", "SocketIOClient": "[3.1.1, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" + } + }, + "sectester.scan": { + "type": "Project", + "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", "System.Linq.Async": "[6.0.1, )" } } diff --git a/test/SecTester.Reporter.Tests/packages.lock.json b/test/SecTester.Reporter.Tests/packages.lock.json index 02830eb..81b1c79 100644 --- a/test/SecTester.Reporter.Tests/packages.lock.json +++ b/test/SecTester.Reporter.Tests/packages.lock.json @@ -82,6 +82,21 @@ "resolved": "3.0.0", "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==" }, + "MessagePack": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "jxJPIkCnKwZcg9qtN1WoR99nlcJl/y/HYOTQLxnyXzR4iE5xhZviCPSKXLe08fcF9Tk4hP7mm+mVVdyUfh2ALw==", + "dependencies": { + "MessagePack.Annotations": "2.5.124", + "Microsoft.NET.StringTools": "17.6.3", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "MessagePack.Annotations": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "7.0.0", @@ -230,6 +245,15 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "Microsoft.NET.StringTools": { + "type": "Transitive", + "resolved": "17.6.3", + "contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA==", + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", @@ -353,15 +377,6 @@ "resolved": "5.11.0", "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", @@ -469,6 +484,49 @@ "resolved": "4.3.0", "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" }, + "SocketIO.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "L5GSyODDjlub5YdDxfsRtA9uxBNw1Hs/egEMhdOGFyD0c63VmvWQ1A4Gfc4GYKYInz1muP4C8QNblXErnUYDqA==" + }, + "SocketIO.Serializer.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "aFanlt2GOGEy7GTGLyh8f8SwhtmQwoPOHTAYCQ0brjg05Nb3F38sk4hYogpII5imyZ7w0spqwNHwpl7FZ49HOA==", + "dependencies": { + "SocketIO.Core": "3.1.1" + } + }, + "SocketIO.Serializer.MessagePack": { + "type": "Transitive", + "resolved": "3.1.2", + "contentHash": "eYSPq7aKP11crDqGA5XlcGtQBqbeydbzgKb6FgySAlUqgGWZ2foXuQLIiBbPJPuH6ygaqycvQimw+oz5328AeA==", + "dependencies": { + "MessagePack": "2.5.124", + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1" + } + }, + "SocketIO.Serializer.SystemTextJson": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "1PKQ+hOAJ4l3ZXlrVgiB3uNY3kLhjzYjnxk/97V6npJrNmhq09Di2EQSpGweQMu6KPbOxjZ7eYVARkGTWIUsjg==", + "dependencies": { + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1", + "System.Text.Json": "7.0.3" + } + }, + "SocketIOClient": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "g8Lauia1Cj5DBXeC9j6vDSJeQEboGmXsnduW06VOBMe+UgqCrenxszYXJg19rAjwO10XRWQorOuU1XNMfYo8Xg==", + "dependencies": { + "SocketIO.Serializer.Core": "3.1.1", + "SocketIO.Serializer.SystemTextJson": "3.1.1", + "System.Collections": "4.3.0" + } + }, "System.AppContext": { "type": "Transitive", "resolved": "4.3.0", @@ -754,8 +812,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==" }, "System.Net.Http": { "type": "Transitive", @@ -1171,19 +1229,19 @@ }, "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Text.Json": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" + "System.Text.Encodings.Web": "7.0.0" } }, "System.Text.RegularExpressions": { @@ -1203,11 +1261,6 @@ "System.Threading.Tasks": "4.3.0" } }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==" - }, "System.Threading.RateLimiting": { "type": "Transitive", "resolved": "7.0.0", @@ -1329,32 +1382,34 @@ "xunit.extensibility.core": "[2.4.1]" } }, - "sectester.bus": { + "sectester.core": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "Microsoft.Extensions.Logging": "[6.0.0, )", + "Microsoft.Extensions.Logging.Console": "[6.0.0, )" } }, - "sectester.core": { + "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", + "SocketIO.Serializer.MessagePack": "[3.1.2, )", + "SocketIOClient": "[3.1.1, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.reporter": { "type": "Project", "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Scan": "[0.40.0, )" + "SecTester.Scan": "[0.41.4, )" } }, "sectester.scan": { @@ -1362,10 +1417,9 @@ "dependencies": { "Macross.Json.Extensions": "[3.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.40.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", + "System.Linq.Async": "[6.0.1, )" } } } diff --git a/test/SecTester.Runner.Tests/packages.lock.json b/test/SecTester.Runner.Tests/packages.lock.json index 50f3db7..0921f01 100644 --- a/test/SecTester.Runner.Tests/packages.lock.json +++ b/test/SecTester.Runner.Tests/packages.lock.json @@ -377,15 +377,6 @@ "resolved": "5.11.0", "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", @@ -1270,11 +1261,6 @@ "System.Threading.Tasks": "4.3.0" } }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==" - }, "System.Threading.RateLimiting": { "type": "Transitive", "resolved": "7.0.0", @@ -1396,19 +1382,6 @@ "xunit.extensibility.core": "[2.4.1]" } }, - "sectester.bus": { - "type": "Project", - "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", - "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.41.3, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" - } - }, "sectester.core": { "type": "Project", "dependencies": { @@ -1420,28 +1393,32 @@ "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.41.3, )", - "SecTester.Core": "[0.41.3, )", + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )" + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.reporter": { "type": "Project", "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Scan": "[0.41.3, )" + "SecTester.Scan": "[0.41.4, )" } }, "sectester.runner": { "type": "Project", "dependencies": { "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Repeater": "[0.41.3, )", - "SecTester.Reporter": "[0.41.3, )", - "SecTester.Scan": "[0.41.3, )" + "SecTester.Repeater": "[0.41.4, )", + "SecTester.Reporter": "[0.41.4, )", + "SecTester.Scan": "[0.41.4, )" } }, "sectester.scan": { @@ -1449,10 +1426,9 @@ "dependencies": { "Macross.Json.Extensions": "[3.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.41.3, )", - "SecTester.Core": "[0.41.3, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", + "System.Linq.Async": "[6.0.1, )" } } } diff --git a/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs index 7d2d718..080c14b 100644 --- a/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -19,7 +19,7 @@ public void AddSecTesterScan_ReturnsDefaultScans() { // arrange _services.AddSecTesterConfig(_config); - _services.AddSecTesterBus(); + _services.AddSecTesterRepeater(); // act _services.AddSecTesterScan(); @@ -35,7 +35,7 @@ public void AddSecTesterScan_ReturnsCiDiscovery() { // arrange _services.AddSecTesterConfig(_config); - _services.AddSecTesterBus(); + _services.AddSecTesterRepeater(); // act _services.AddSecTesterScan(); @@ -51,7 +51,7 @@ public void AddSecTesterScan_ReturnsScanFactory() { // arrange _services.AddSecTesterConfig(_config); - _services.AddSecTesterBus(); + _services.AddSecTesterRepeater(); // act _services.AddSecTesterScan(); diff --git a/test/SecTester.Scan.Tests/SecTester.Scan.Tests.csproj b/test/SecTester.Scan.Tests/SecTester.Scan.Tests.csproj index 74f1e6a..f0b265b 100644 --- a/test/SecTester.Scan.Tests/SecTester.Scan.Tests.csproj +++ b/test/SecTester.Scan.Tests/SecTester.Scan.Tests.csproj @@ -5,13 +5,11 @@ - - diff --git a/test/SecTester.Scan.Tests/Usings.cs b/test/SecTester.Scan.Tests/Usings.cs index b5f34bb..f81513d 100644 --- a/test/SecTester.Scan.Tests/Usings.cs +++ b/test/SecTester.Scan.Tests/Usings.cs @@ -11,12 +11,12 @@ global using NSubstitute; global using NSubstitute.ClearExtensions; global using NSubstitute.ExceptionExtensions; -global using SecTester.Bus.Dispatchers; -global using SecTester.Bus.Extensions; global using SecTester.Core; global using SecTester.Core.Bus; global using SecTester.Core.Exceptions; global using SecTester.Core.Utils; +global using SecTester.Repeater.Dispatchers; +global using SecTester.Repeater.Extensions; global using SecTester.Scan.CI; global using SecTester.Scan.Commands; global using SecTester.Scan.Exceptions; diff --git a/test/SecTester.Scan.Tests/packages.lock.json b/test/SecTester.Scan.Tests/packages.lock.json index 5ef1f12..7f06915 100644 --- a/test/SecTester.Scan.Tests/packages.lock.json +++ b/test/SecTester.Scan.Tests/packages.lock.json @@ -61,16 +61,6 @@ "Microsoft.Bcl.AsyncInterfaces": "6.0.0" } }, - "System.Text.Json": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" - } - }, "xunit": { "type": "Direct", "requested": "[2.4.1, )", @@ -101,6 +91,21 @@ "resolved": "3.0.0", "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==" }, + "MessagePack": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "jxJPIkCnKwZcg9qtN1WoR99nlcJl/y/HYOTQLxnyXzR4iE5xhZviCPSKXLe08fcF9Tk4hP7mm+mVVdyUfh2ALw==", + "dependencies": { + "MessagePack.Annotations": "2.5.124", + "Microsoft.NET.StringTools": "17.6.3", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "MessagePack.Annotations": { + "type": "Transitive", + "resolved": "2.5.124", + "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "7.0.0", @@ -249,6 +254,15 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "Microsoft.NET.StringTools": { + "type": "Transitive", + "resolved": "17.6.3", + "contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA==", + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", @@ -372,15 +386,6 @@ "resolved": "5.11.0", "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" }, - "RabbitMQ.Client": { - "type": "Transitive", - "resolved": "6.4.0", - "contentHash": "1znR1gGU+xYVSpO5z8nQolcUKA/yydnxQn7Ug9+RUXxTSLMm/eE58VKGwahPBjELXvDnX0k/kBrAitFLRjx9LA==", - "dependencies": { - "System.Memory": "4.5.4", - "System.Threading.Channels": "4.7.1" - } - }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", @@ -488,6 +493,49 @@ "resolved": "4.3.0", "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" }, + "SocketIO.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "L5GSyODDjlub5YdDxfsRtA9uxBNw1Hs/egEMhdOGFyD0c63VmvWQ1A4Gfc4GYKYInz1muP4C8QNblXErnUYDqA==" + }, + "SocketIO.Serializer.Core": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "aFanlt2GOGEy7GTGLyh8f8SwhtmQwoPOHTAYCQ0brjg05Nb3F38sk4hYogpII5imyZ7w0spqwNHwpl7FZ49HOA==", + "dependencies": { + "SocketIO.Core": "3.1.1" + } + }, + "SocketIO.Serializer.MessagePack": { + "type": "Transitive", + "resolved": "3.1.2", + "contentHash": "eYSPq7aKP11crDqGA5XlcGtQBqbeydbzgKb6FgySAlUqgGWZ2foXuQLIiBbPJPuH6ygaqycvQimw+oz5328AeA==", + "dependencies": { + "MessagePack": "2.5.124", + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1" + } + }, + "SocketIO.Serializer.SystemTextJson": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "1PKQ+hOAJ4l3ZXlrVgiB3uNY3kLhjzYjnxk/97V6npJrNmhq09Di2EQSpGweQMu6KPbOxjZ7eYVARkGTWIUsjg==", + "dependencies": { + "SocketIO.Core": "3.1.1", + "SocketIO.Serializer.Core": "3.1.1", + "System.Text.Json": "7.0.3" + } + }, + "SocketIOClient": { + "type": "Transitive", + "resolved": "3.1.1", + "contentHash": "g8Lauia1Cj5DBXeC9j6vDSJeQEboGmXsnduW06VOBMe+UgqCrenxszYXJg19rAjwO10XRWQorOuU1XNMfYo8Xg==", + "dependencies": { + "SocketIO.Serializer.Core": "3.1.1", + "SocketIO.Serializer.SystemTextJson": "3.1.1", + "System.Collections": "4.3.0" + } + }, "System.AppContext": { "type": "Transitive", "resolved": "4.3.0", @@ -765,8 +813,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==" }, "System.Net.Http": { "type": "Transitive", @@ -1182,12 +1230,21 @@ }, "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0" + } + }, "System.Text.RegularExpressions": { "type": "Transitive", "resolved": "4.3.0", @@ -1205,11 +1262,6 @@ "System.Threading.Tasks": "4.3.0" } }, - "System.Threading.Channels": { - "type": "Transitive", - "resolved": "4.7.1", - "contentHash": "6akRtHK/wab3246t4p5v3HQrtQk8LboOt5T4dtpNgsp3zvDeM4/Gx8V12t0h+c/W9/enUrilk8n6EQqdQorZAA==" - }, "System.Threading.RateLimiting": { "type": "Transitive", "resolved": "7.0.0", @@ -1331,25 +1383,27 @@ "xunit.extensibility.core": "[2.4.1]" } }, - "sectester.bus": { + "sectester.core": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", - "RabbitMQ.Client": "[6.4.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Text.Json": "[6.0.0, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "Microsoft.Extensions.Logging": "[6.0.0, )", + "Microsoft.Extensions.Logging.Console": "[6.0.0, )" } }, - "sectester.core": { + "sectester.repeater": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Http": "[6.0.0, )", + "SecTester.Core": "[0.41.4, )", + "SocketIO.Serializer.MessagePack": "[3.1.2, )", + "SocketIOClient": "[3.1.1, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.scan": { @@ -1357,10 +1411,9 @@ "dependencies": { "Macross.Json.Extensions": "[3.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "SecTester.Bus": "[0.40.0, )", - "SecTester.Core": "[0.40.0, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[6.0.0, )" + "SecTester.Core": "[0.41.4, )", + "SecTester.Repeater": "[0.41.4, )", + "System.Linq.Async": "[6.0.1, )" } } } From aa28055829832e431e9d5368a03d25f72da59fdc Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Wed, 12 Jun 2024 18:37:52 +0700 Subject: [PATCH 2/6] feat(bus): fix formatting and reorder usings closes #172 --- .../Api/DeleteRepeaterRequest.cs | 2 +- .../Dispatchers/HttpCommandDispatcher.cs | 4 ++-- .../ExponentialBackoffIRetryStrategy.cs | 2 +- src/SecTester.Scan/Commands/DeleteScan.cs | 2 +- src/SecTester.Scan/Commands/StopScan.cs | 2 +- test/SecTester.Repeater.Tests/Usings.cs | 16 +++++----------- test/SecTester.Reporter.Tests/Usings.cs | 1 - .../CI/VendorMatcherTests.cs | 3 ++- test/SecTester.Scan.Tests/Usings.cs | 5 ++--- 9 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs index b18390b..d6bb83f 100644 --- a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs +++ b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs @@ -1,6 +1,6 @@ using System.Net.Http; -using SecTester.Repeater.Commands; using SecTester.Core; +using SecTester.Repeater.Commands; namespace SecTester.Repeater.Api; diff --git a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs index f7f58e2..b2daae3 100644 --- a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs +++ b/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs @@ -5,10 +5,10 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using SecTester.Repeater.Commands; -using SecTester.Repeater.Extensions; using SecTester.Core.Bus; using SecTester.Core.Utils; +using SecTester.Repeater.Commands; +using SecTester.Repeater.Extensions; namespace SecTester.Repeater.Dispatchers; diff --git a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs index 71799e5..748b617 100644 --- a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs +++ b/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs @@ -2,8 +2,8 @@ using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; -using SecTester.Repeater.Exceptions; using SecTester.Core.Bus; +using SecTester.Repeater.Exceptions; namespace SecTester.Repeater.RetryStrategies; diff --git a/src/SecTester.Scan/Commands/DeleteScan.cs b/src/SecTester.Scan/Commands/DeleteScan.cs index 19796ed..88008e9 100644 --- a/src/SecTester.Scan/Commands/DeleteScan.cs +++ b/src/SecTester.Scan/Commands/DeleteScan.cs @@ -1,5 +1,5 @@ -using SecTester.Repeater.Commands; using SecTester.Core; +using SecTester.Repeater.Commands; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/StopScan.cs b/src/SecTester.Scan/Commands/StopScan.cs index 64f930c..60e6a82 100644 --- a/src/SecTester.Scan/Commands/StopScan.cs +++ b/src/SecTester.Scan/Commands/StopScan.cs @@ -1,5 +1,5 @@ -using SecTester.Repeater.Commands; using SecTester.Core; +using SecTester.Repeater.Commands; namespace SecTester.Scan.Commands; diff --git a/test/SecTester.Repeater.Tests/Usings.cs b/test/SecTester.Repeater.Tests/Usings.cs index 2fe5b6c..cd2b35c 100644 --- a/test/SecTester.Repeater.Tests/Usings.cs +++ b/test/SecTester.Repeater.Tests/Usings.cs @@ -1,18 +1,12 @@ global using System.Net; -global using System.Net.Sockets; global using System.Net.Http.Json; -global using System.Net.WebSockets; +global using System.Net.Sockets; global using System.Text; global using System.Text.Json; global using System.Text.Json.Serialization; global using System.Text.RegularExpressions; global using System.Timers; global using FluentAssertions; -global using Microsoft.AspNetCore; -global using Microsoft.AspNetCore.Builder; -global using Microsoft.AspNetCore.Hosting; -global using Microsoft.AspNetCore.Mvc.Testing; -global using Microsoft.AspNetCore.TestHost; global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.DependencyInjection.Extensions; global using Microsoft.Extensions.Logging; @@ -23,17 +17,17 @@ global using RichardSzalay.MockHttp; global using SecTester.Core; global using SecTester.Core.Bus; -global using SecTester.Core.Logger; global using SecTester.Core.Exceptions; +global using SecTester.Core.Logger; global using SecTester.Core.Utils; global using SecTester.Repeater.Api; global using SecTester.Repeater.Bus; -global using SecTester.Repeater.Extensions; -global using SecTester.Repeater.Runners; -global using SecTester.Repeater.Tests.Mocks; global using SecTester.Repeater.Commands; global using SecTester.Repeater.Dispatchers; global using SecTester.Repeater.Exceptions; +global using SecTester.Repeater.Extensions; global using SecTester.Repeater.RetryStrategies; +global using SecTester.Repeater.Runners; +global using SecTester.Repeater.Tests.Mocks; global using Xunit; diff --git a/test/SecTester.Reporter.Tests/Usings.cs b/test/SecTester.Reporter.Tests/Usings.cs index 0d08de5..2781870 100644 --- a/test/SecTester.Reporter.Tests/Usings.cs +++ b/test/SecTester.Reporter.Tests/Usings.cs @@ -1,4 +1,3 @@ global using FluentAssertions; global using SecTester.Scan.Models; global using Xunit; -global using Microsoft.Extensions.DependencyInjection; diff --git a/test/SecTester.Scan.Tests/CI/VendorMatcherTests.cs b/test/SecTester.Scan.Tests/CI/VendorMatcherTests.cs index 122c96c..961db46 100644 --- a/test/SecTester.Scan.Tests/CI/VendorMatcherTests.cs +++ b/test/SecTester.Scan.Tests/CI/VendorMatcherTests.cs @@ -4,7 +4,8 @@ public class VendorMatcherTests { private readonly JsonSerializerOptions _options = new() { - PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase + PropertyNameCaseInsensitive = true, + PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; public static readonly IEnumerable MatchEnvInput = new List diff --git a/test/SecTester.Scan.Tests/Usings.cs b/test/SecTester.Scan.Tests/Usings.cs index f81513d..b1bc4bc 100644 --- a/test/SecTester.Scan.Tests/Usings.cs +++ b/test/SecTester.Scan.Tests/Usings.cs @@ -1,9 +1,8 @@ +global using System.Collections; global using System.Net.Http.Headers; global using System.Net.Http.Json; -global using System.Collections; -global using System.Collections.Specialized; -global using System.Text.Json; global using System.Text; +global using System.Text.Json; global using System.Text.RegularExpressions; global using FluentAssertions; global using Microsoft.Extensions.DependencyInjection; From 245001695078e278a85b69fea84eae99f409fedd Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Wed, 12 Jun 2024 18:38:57 +0700 Subject: [PATCH 3/6] feat(bus): address duplication issue closes #172 --- .../Internal/HttpMethods.cs | 2 +- ...sonHttpMethodEnumerationStringConverter.cs | 30 ++----------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/SecTester.Repeater/Internal/HttpMethods.cs b/src/SecTester.Repeater/Internal/HttpMethods.cs index 1900399..e1069f6 100644 --- a/src/SecTester.Repeater/Internal/HttpMethods.cs +++ b/src/SecTester.Repeater/Internal/HttpMethods.cs @@ -6,7 +6,7 @@ namespace SecTester.Repeater.Internal; -public class HttpMethods +public static class HttpMethods { public static IDictionary Items { get; } = typeof(HttpMethod) .GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly) diff --git a/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs b/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs index 0d1b322..5a87c89 100644 --- a/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs +++ b/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; -using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; @@ -10,36 +7,13 @@ namespace SecTester.Repeater.Internal; internal class JsonHttpMethodEnumerationStringConverter : JsonConverter { - private static readonly IEnumerable BaseMethods = typeof(HttpMethod) - .GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly) - .Where(x => x.PropertyType.IsAssignableFrom(typeof(HttpMethod))) - .Select(x => x.GetValue(null)) - .Cast(); - - private static readonly IEnumerable CustomMethods = new List - { - new("PATCH"), - new("COPY"), - new("LINK"), - new("UNLINK"), - new("PURGE"), - new("LOCK"), - new("UNLOCK"), - new("PROPFIND"), - new("VIEW") - }; - - private static readonly IDictionary Methods = BaseMethods.Concat(CustomMethods).Distinct() - .ToDictionary(x => x.Method, x => x, StringComparer.InvariantCultureIgnoreCase); - - public override HttpMethod? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { switch (reader.TokenType) { case JsonTokenType.String: var token = reader.GetString(); - if (token is null || !Methods.TryGetValue(token, out var method)) + if (token is null || !HttpMethods.Items.TryGetValue(token, out var method)) { throw new JsonException( $"Unexpected value {token} when parsing the {nameof(HttpMethod)}."); @@ -56,7 +30,7 @@ internal class JsonHttpMethodEnumerationStringConverter : JsonConverter Date: Mon, 17 Jun 2024 14:27:18 +0700 Subject: [PATCH 4/6] feat(repeater): address pr comments closes #172 --- SecTester.sln | 4 +- .../Commands/HttpRequest.cs | 2 +- .../Dispatchers/HttpCommandDispatcher.cs | 6 +- .../HttpCommandDispatcherConfig.cs | 2 +- .../Dispatchers/RateLimitedHandler.cs | 2 +- .../Exceptions/HttpStatusException.cs | 2 +- .../HttpResponseMessageExtensions.cs | 4 +- .../Extensions/ServiceCollectionExtensions.cs | 47 ++++ .../Internal/HttpMethods.cs | 2 +- .../Internal/JsonHeadersConverter.cs | 2 +- ...sonHttpMethodEnumerationStringConverter.cs | 2 +- .../Internal/JsonSnakeCaseNamingPolicy.cs | 2 +- .../Internal}/MessageSerializer.cs | 4 +- .../ExponentialBackoffIRetryStrategy.cs | 4 +- .../ExponentialBackoffOptions.cs | 2 +- src/SecTester.Core/SecTester.Core.csproj | 22 ++ src/SecTester.Core/packages.lock.json | 102 +++++-- .../Api/CreateRepeaterRequest.cs | 4 +- .../Api/DeleteRepeaterRequest.cs | 2 +- src/SecTester.Repeater/Bus/IncomingRequest.cs | 2 +- .../Extensions/ServiceCollectionExtensions.cs | 45 +-- .../MessagePackHttpMethodFormatter.cs | 1 + .../SecTester.Repeater.csproj | 11 +- src/SecTester.Repeater/packages.lock.json | 126 ++++----- src/SecTester.Reporter/packages.lock.json | 16 +- src/SecTester.Runner/packages.lock.json | 16 +- src/SecTester.Scan/Commands/CreateScan.cs | 4 +- src/SecTester.Scan/Commands/DeleteScan.cs | 2 +- src/SecTester.Scan/Commands/GetScan.cs | 2 +- src/SecTester.Scan/Commands/ListIssues.cs | 2 +- src/SecTester.Scan/Commands/StopScan.cs | 2 +- src/SecTester.Scan/Commands/UploadHar.cs | 4 +- src/SecTester.Scan/packages.lock.json | 16 +- .../Dispatchers/HttpCommandDispatcherTests.cs | 7 +- .../Dispatchers/MessageSerializerTests.cs | 201 ++++++++++++++ .../HttpResponseMessageExtensionsTests.cs | 5 +- .../ServiceCollectionExtensionsTests.cs | 76 +++++ .../Fixtures/BazQux.cs | 2 +- .../Fixtures/FooBar.cs | 2 +- .../Fixtures/FooBaz.cs | 2 +- .../Fixtures/FooEnum.cs | 2 +- .../Fixtures/IMockInterface.cs | 2 +- .../ExponentialBackoffRetryStrategyTests.cs | 6 +- .../SecTester.Core.Tests.csproj | 8 + test/SecTester.Core.Tests/Usings.cs | 9 + test/SecTester.Core.Tests/packages.lock.json | 260 +++++++++++++++++- .../ServiceCollectionExtensionsTests.cs | 67 ----- .../Fixtures/ConcreteCommand.cs | 8 - .../Fixtures/ConcreteCommand2.cs | 8 - .../SecTester.Repeater.Tests.csproj | 1 - test/SecTester.Repeater.Tests/Usings.cs | 7 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../SecTester.Runner.Tests/packages.lock.json | 16 +- .../ServiceCollectionExtensionsTests.cs | 2 +- .../MessageSerializerTests.cs | 180 +----------- test/SecTester.Scan.Tests/Usings.cs | 4 +- test/SecTester.Scan.Tests/packages.lock.json | 16 +- 58 files changed, 868 insertions(+), 521 deletions(-) rename src/{SecTester.Repeater => SecTester.Core}/Commands/HttpRequest.cs (94%) rename src/{SecTester.Repeater => SecTester.Core}/Dispatchers/HttpCommandDispatcher.cs (97%) rename src/{SecTester.Repeater => SecTester.Core}/Dispatchers/HttpCommandDispatcherConfig.cs (74%) rename src/{SecTester.Repeater => SecTester.Core}/Dispatchers/RateLimitedHandler.cs (97%) rename src/{SecTester.Repeater => SecTester.Core}/Exceptions/HttpStatusException.cs (89%) rename src/{SecTester.Repeater => SecTester.Core}/Extensions/HttpResponseMessageExtensions.cs (95%) rename src/{SecTester.Repeater => SecTester.Core}/Internal/HttpMethods.cs (95%) rename src/{SecTester.Repeater => SecTester.Core}/Internal/JsonHeadersConverter.cs (98%) rename src/{SecTester.Repeater => SecTester.Core}/Internal/JsonHttpMethodEnumerationStringConverter.cs (96%) rename src/{SecTester.Repeater => SecTester.Core}/Internal/JsonSnakeCaseNamingPolicy.cs (88%) rename src/{SecTester.Repeater/Dispatchers => SecTester.Core/Internal}/MessageSerializer.cs (91%) rename src/{SecTester.Repeater => SecTester.Core}/RetryStrategies/ExponentialBackoffIRetryStrategy.cs (93%) rename src/{SecTester.Repeater => SecTester.Core}/RetryStrategies/ExponentialBackoffOptions.cs (64%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Dispatchers/HttpCommandDispatcherTests.cs (98%) create mode 100644 test/SecTester.Core.Tests/Dispatchers/MessageSerializerTests.cs rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Extensions/HttpResponseMessageExtensionsTests.cs (97%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Fixtures/BazQux.cs (74%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Fixtures/FooBar.cs (74%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Fixtures/FooBaz.cs (66%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Fixtures/FooEnum.cs (73%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/Fixtures/IMockInterface.cs (61%) rename test/{SecTester.Repeater.Tests => SecTester.Core.Tests}/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs (96%) delete mode 100644 test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs delete mode 100644 test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs rename test/{SecTester.Repeater.Tests/Dispatchers => SecTester.Scan.Tests}/MessageSerializerTests.cs (56%) diff --git a/SecTester.sln b/SecTester.sln index 74902e6..046aec8 100644 --- a/SecTester.sln +++ b/SecTester.sln @@ -84,8 +84,8 @@ Global {F5E1A845-BDCF-46D0-A8FE-CE47D41D35F7} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {A48670DA-9103-4AAB-8914-6B7FDCD8654E} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {64E65289-A36D-46C6-9410-6B2040A51E8A} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} - {5608AF78-4476-47F0-8CEB-FD9849E8778B} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} - {0B9D9422-FBB0-4B21-B3C1-9927DDEDA702} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} + {5608AF78-4476-47F0-8CEB-FD9849E8778B} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} + {0B9D9422-FBB0-4B21-B3C1-9927DDEDA702} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} {853E5140-4448-41EA-8F2B-9C9FF2B5491E} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} {368F1410-F710-4678-8376-7FC356CFD338} = {27E70918-C7EB-4711-BCB9-CE1C9C0A5C5B} {5FC5E230-64F6-45F1-8661-1FF856FA6BC6} = {2C77C898-B581-47F6-A8BF-3C1EE589F052} diff --git a/src/SecTester.Repeater/Commands/HttpRequest.cs b/src/SecTester.Core/Commands/HttpRequest.cs similarity index 94% rename from src/SecTester.Repeater/Commands/HttpRequest.cs rename to src/SecTester.Core/Commands/HttpRequest.cs index d7ec4a9..47badaa 100644 --- a/src/SecTester.Repeater/Commands/HttpRequest.cs +++ b/src/SecTester.Core/Commands/HttpRequest.cs @@ -3,7 +3,7 @@ using System.Net.Http; using SecTester.Core.Bus; -namespace SecTester.Repeater.Commands; +namespace SecTester.Core.Commands; public record HttpRequest : Command { diff --git a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs b/src/SecTester.Core/Dispatchers/HttpCommandDispatcher.cs similarity index 97% rename from src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs rename to src/SecTester.Core/Dispatchers/HttpCommandDispatcher.cs index b2daae3..14dd140 100644 --- a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcher.cs +++ b/src/SecTester.Core/Dispatchers/HttpCommandDispatcher.cs @@ -7,10 +7,10 @@ using System.Threading.Tasks; using SecTester.Core.Bus; using SecTester.Core.Utils; -using SecTester.Repeater.Commands; -using SecTester.Repeater.Extensions; +using SecTester.Core.Commands; +using SecTester.Core.Extensions; -namespace SecTester.Repeater.Dispatchers; +namespace SecTester.Core.Dispatchers; public class HttpCommandDispatcher : ICommandDispatcher { diff --git a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs b/src/SecTester.Core/Dispatchers/HttpCommandDispatcherConfig.cs similarity index 74% rename from src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs rename to src/SecTester.Core/Dispatchers/HttpCommandDispatcherConfig.cs index 7c8a0cd..da5e2ff 100644 --- a/src/SecTester.Repeater/Dispatchers/HttpCommandDispatcherConfig.cs +++ b/src/SecTester.Core/Dispatchers/HttpCommandDispatcherConfig.cs @@ -1,5 +1,5 @@ using System; -namespace SecTester.Repeater.Dispatchers; +namespace SecTester.Core.Dispatchers; public sealed record HttpCommandDispatcherConfig(string BaseUrl, string Token, TimeSpan? Timeout = null); diff --git a/src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs b/src/SecTester.Core/Dispatchers/RateLimitedHandler.cs similarity index 97% rename from src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs rename to src/SecTester.Core/Dispatchers/RateLimitedHandler.cs index be370fa..544a01c 100644 --- a/src/SecTester.Repeater/Dispatchers/RateLimitedHandler.cs +++ b/src/SecTester.Core/Dispatchers/RateLimitedHandler.cs @@ -7,7 +7,7 @@ using System.Threading.RateLimiting; using System.Threading.Tasks; -namespace SecTester.Repeater.Dispatchers; +namespace SecTester.Core.Dispatchers; [ExcludeFromCodeCoverage] internal sealed class RateLimitedHandler diff --git a/src/SecTester.Repeater/Exceptions/HttpStatusException.cs b/src/SecTester.Core/Exceptions/HttpStatusException.cs similarity index 89% rename from src/SecTester.Repeater/Exceptions/HttpStatusException.cs rename to src/SecTester.Core/Exceptions/HttpStatusException.cs index 6ff452b..799fd30 100644 --- a/src/SecTester.Repeater/Exceptions/HttpStatusException.cs +++ b/src/SecTester.Core/Exceptions/HttpStatusException.cs @@ -1,7 +1,7 @@ using System.Net; using System.Net.Http; -namespace SecTester.Repeater.Exceptions; +namespace SecTester.Core.Exceptions; public class HttpStatusException : HttpRequestException { diff --git a/src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs b/src/SecTester.Core/Extensions/HttpResponseMessageExtensions.cs similarity index 95% rename from src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs rename to src/SecTester.Core/Extensions/HttpResponseMessageExtensions.cs index 744343a..d3ceb82 100644 --- a/src/SecTester.Repeater/Extensions/HttpResponseMessageExtensions.cs +++ b/src/SecTester.Core/Extensions/HttpResponseMessageExtensions.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using SecTester.Repeater.Exceptions; +using SecTester.Core.Exceptions; -namespace SecTester.Repeater.Extensions; +namespace SecTester.Core.Extensions; internal static class HttpResponseMessageExtensions { diff --git a/src/SecTester.Core/Extensions/ServiceCollectionExtensions.cs b/src/SecTester.Core/Extensions/ServiceCollectionExtensions.cs index 96252e1..3d4dc5c 100644 --- a/src/SecTester.Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/SecTester.Core/Extensions/ServiceCollectionExtensions.cs @@ -1,7 +1,13 @@ +using System; +using System.Net.Http; +using System.Threading.RateLimiting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; +using SecTester.Core.Bus; +using SecTester.Core.Dispatchers; using SecTester.Core.Logger; +using SecTester.Core.RetryStrategies; using SecTester.Core.Utils; namespace SecTester.Core.Extensions; @@ -35,4 +41,45 @@ public static IServiceCollection AddSecTesterConfig(this IServiceCollection coll } ); }); + + public static IServiceCollection AddHttpCommandDispatcher(this IServiceCollection collection) => + collection + .AddSingleton(new ExponentialBackoffOptions()) + .AddSingleton() + .AddScoped(sp => + { + var config = sp.GetRequiredService(); + return new HttpCommandDispatcherConfig(config.Api, config.Credentials!.Token, TimeSpan.FromSeconds(10)); + }) + .AddScoped() + .AddScoped(sp => sp.GetRequiredService()) + .AddHttpClientForHttpCommandDispatcher(); + + private static IServiceCollection AddHttpClientForHttpCommandDispatcher(this IServiceCollection collection) + { + collection + .AddHttpClient(nameof(HttpCommandDispatcher), ConfigureHttpClientForHttpCommandDispatcher) + .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandlerForHttpCommandDispatcher); + + return collection; + } + + private static HttpMessageHandler CreateHttpMessageHandlerForHttpCommandDispatcher() + { + var options = new FixedWindowRateLimiterOptions + { + Window = TimeSpan.FromSeconds(60), + PermitLimit = 10, + QueueLimit = 5 + }; + var rateLimiter = new FixedWindowRateLimiter(options); + + return new RateLimitedHandler(rateLimiter); + } + + private static void ConfigureHttpClientForHttpCommandDispatcher(IServiceProvider sp, HttpClient client) + { + var config = sp.GetRequiredService(); + client.Timeout = (TimeSpan)config.Timeout!; + } } diff --git a/src/SecTester.Repeater/Internal/HttpMethods.cs b/src/SecTester.Core/Internal/HttpMethods.cs similarity index 95% rename from src/SecTester.Repeater/Internal/HttpMethods.cs rename to src/SecTester.Core/Internal/HttpMethods.cs index e1069f6..12c431b 100644 --- a/src/SecTester.Repeater/Internal/HttpMethods.cs +++ b/src/SecTester.Core/Internal/HttpMethods.cs @@ -4,7 +4,7 @@ using System.Net.Http; using System.Reflection; -namespace SecTester.Repeater.Internal; +namespace SecTester.Core.Internal; public static class HttpMethods { diff --git a/src/SecTester.Repeater/Internal/JsonHeadersConverter.cs b/src/SecTester.Core/Internal/JsonHeadersConverter.cs similarity index 98% rename from src/SecTester.Repeater/Internal/JsonHeadersConverter.cs rename to src/SecTester.Core/Internal/JsonHeadersConverter.cs index 23662eb..6cf3989 100644 --- a/src/SecTester.Repeater/Internal/JsonHeadersConverter.cs +++ b/src/SecTester.Core/Internal/JsonHeadersConverter.cs @@ -4,7 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace SecTester.Repeater.Internal; +namespace SecTester.Core.Internal; internal sealed class JsonHeadersConverter : JsonConverter>>> { diff --git a/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs b/src/SecTester.Core/Internal/JsonHttpMethodEnumerationStringConverter.cs similarity index 96% rename from src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs rename to src/SecTester.Core/Internal/JsonHttpMethodEnumerationStringConverter.cs index 5a87c89..418ecbf 100644 --- a/src/SecTester.Repeater/Internal/JsonHttpMethodEnumerationStringConverter.cs +++ b/src/SecTester.Core/Internal/JsonHttpMethodEnumerationStringConverter.cs @@ -3,7 +3,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace SecTester.Repeater.Internal; +namespace SecTester.Core.Internal; internal class JsonHttpMethodEnumerationStringConverter : JsonConverter { diff --git a/src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs b/src/SecTester.Core/Internal/JsonSnakeCaseNamingPolicy.cs similarity index 88% rename from src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs rename to src/SecTester.Core/Internal/JsonSnakeCaseNamingPolicy.cs index 83f47e5..67e3846 100644 --- a/src/SecTester.Repeater/Internal/JsonSnakeCaseNamingPolicy.cs +++ b/src/SecTester.Core/Internal/JsonSnakeCaseNamingPolicy.cs @@ -1,7 +1,7 @@ using System.Text.Json; using SecTester.Core.Utils; -namespace SecTester.Repeater.Internal; +namespace SecTester.Core.Internal; internal class JsonSnakeCaseNamingPolicy : JsonNamingPolicy { diff --git a/src/SecTester.Repeater/Dispatchers/MessageSerializer.cs b/src/SecTester.Core/Internal/MessageSerializer.cs similarity index 91% rename from src/SecTester.Repeater/Dispatchers/MessageSerializer.cs rename to src/SecTester.Core/Internal/MessageSerializer.cs index ca41c5a..dd53f34 100644 --- a/src/SecTester.Repeater/Dispatchers/MessageSerializer.cs +++ b/src/SecTester.Core/Internal/MessageSerializer.cs @@ -1,9 +1,9 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; -using SecTester.Repeater.Internal; +using SecTester.Core.Internal; -namespace SecTester.Repeater.Dispatchers; +namespace SecTester.Core.Dispatchers; public static class MessageSerializer { diff --git a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs b/src/SecTester.Core/RetryStrategies/ExponentialBackoffIRetryStrategy.cs similarity index 93% rename from src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs rename to src/SecTester.Core/RetryStrategies/ExponentialBackoffIRetryStrategy.cs index 748b617..84812a4 100644 --- a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffIRetryStrategy.cs +++ b/src/SecTester.Core/RetryStrategies/ExponentialBackoffIRetryStrategy.cs @@ -3,9 +3,9 @@ using System.Threading; using System.Threading.Tasks; using SecTester.Core.Bus; -using SecTester.Repeater.Exceptions; +using SecTester.Core.Exceptions; -namespace SecTester.Repeater.RetryStrategies; +namespace SecTester.Core.RetryStrategies; public class ExponentialBackoffIRetryStrategy : IRetryStrategy { diff --git a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs b/src/SecTester.Core/RetryStrategies/ExponentialBackoffOptions.cs similarity index 64% rename from src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs rename to src/SecTester.Core/RetryStrategies/ExponentialBackoffOptions.cs index 63e040d..fcde8a2 100644 --- a/src/SecTester.Repeater/RetryStrategies/ExponentialBackoffOptions.cs +++ b/src/SecTester.Core/RetryStrategies/ExponentialBackoffOptions.cs @@ -1,3 +1,3 @@ -namespace SecTester.Repeater.RetryStrategies; +namespace SecTester.Core.RetryStrategies; public record ExponentialBackoffOptions(int MaxDepth = 3, int MinInterval = 50); diff --git a/src/SecTester.Core/SecTester.Core.csproj b/src/SecTester.Core/SecTester.Core.csproj index 3421b84..2fa7ef1 100644 --- a/src/SecTester.Core/SecTester.Core.csproj +++ b/src/SecTester.Core/SecTester.Core.csproj @@ -6,9 +6,15 @@ + + + + + + @@ -16,7 +22,23 @@ + + + + + + + + + + + <_Parameter1>$(MSBuildProjectName).Tests + + + <_Parameter1>DynamicProxyGenAssembly2 + + diff --git a/src/SecTester.Core/packages.lock.json b/src/SecTester.Core/packages.lock.json index 50f7397..ae56883 100644 --- a/src/SecTester.Core/packages.lock.json +++ b/src/SecTester.Core/packages.lock.json @@ -2,6 +2,25 @@ "version": 1, "dependencies": { ".NETStandard,Version=v2.0": { + "Macross.Json.Extensions": { + "type": "Direct", + "requested": "[3.0.0, )", + "resolved": "3.0.0", + "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", + "dependencies": { + "System.Reflection.Emit.Lightweight": "4.7.0", + "System.Text.Json": "6.0.0" + } + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Direct", "requested": "[6.0.0, )", @@ -12,6 +31,18 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, + "Microsoft.Extensions.Http": { + "type": "Direct", + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, "Microsoft.Extensions.Logging": { "type": "Direct", "requested": "[6.0.0, )", @@ -51,11 +82,37 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==", + "System.Linq.Async": { + "type": "Direct", + "requested": "[6.0.1, )", + "resolved": "6.0.1", + "contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, + "System.Text.Json": { + "type": "Direct", + "requested": "[7.0.3, )", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Threading.RateLimiting": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", "System.Threading.Tasks.Extensions": "4.5.4" } }, @@ -176,8 +233,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", "dependencies": { "System.Buffers": "4.5.1", "System.Numerics.Vectors": "4.4.0", @@ -189,33 +246,32 @@ "resolved": "4.5.0", "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" }, - "System.Runtime.CompilerServices.Unsafe": { + "System.Reflection.Emit.ILGeneration": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" + "resolved": "4.7.0", + "contentHash": "AucBYo3DSI0IDxdUjKksBcQJXPHyoPyrCXYURW1WDsLI4M65Ar/goSHjdnHOAY9MiYDNKqDlIgaYm+zL2hA1KA==" }, - "System.Text.Encodings.Web": { + "System.Reflection.Emit.Lightweight": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "4.7.0", + "contentHash": "a4OLB4IITxAXJeV74MDx49Oq2+PsF6Sml54XAFv+2RyWwtDBcabzoxiiJRhdhx+gaohLh4hEGCLQyBozXoQPqA==", "dependencies": { - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" + "System.Reflection.Emit.ILGeneration": "4.7.0" } }, - "System.Text.Json": { + "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" + }, + "System.Text.Encodings.Web": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0", "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Threading.Tasks.Extensions": { diff --git a/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs b/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs index 9ff7c2a..32134b7 100644 --- a/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs +++ b/src/SecTester.Repeater/Api/CreateRepeaterRequest.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Text; -using SecTester.Repeater.Commands; -using SecTester.Repeater.Dispatchers; +using SecTester.Core.Commands; +using SecTester.Core.Dispatchers; namespace SecTester.Repeater.Api; diff --git a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs index d6bb83f..2fb23d2 100644 --- a/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs +++ b/src/SecTester.Repeater/Api/DeleteRepeaterRequest.cs @@ -1,6 +1,6 @@ using System.Net.Http; using SecTester.Core; -using SecTester.Repeater.Commands; +using SecTester.Core.Commands; namespace SecTester.Repeater.Api; diff --git a/src/SecTester.Repeater/Bus/IncomingRequest.cs b/src/SecTester.Repeater/Bus/IncomingRequest.cs index ff859fd..9285408 100644 --- a/src/SecTester.Repeater/Bus/IncomingRequest.cs +++ b/src/SecTester.Repeater/Bus/IncomingRequest.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Net.Http; using MessagePack; -using SecTester.Repeater.Internal; +using SecTester.Core.Internal; using SecTester.Repeater.Runners; namespace SecTester.Repeater.Bus; diff --git a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs index 92be4a6..92dd443 100644 --- a/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs +++ b/src/SecTester.Repeater/Extensions/ServiceCollectionExtensions.cs @@ -2,15 +2,11 @@ using System.Linq; using System.Net; using System.Net.Http; -using System.Threading.RateLimiting; using Microsoft.Extensions.DependencyInjection; -using SecTester.Core; -using SecTester.Core.Bus; +using SecTester.Core.Extensions; using SecTester.Core.Utils; using SecTester.Repeater.Api; using SecTester.Repeater.Bus; -using SecTester.Repeater.Dispatchers; -using SecTester.Repeater.RetryStrategies; using SecTester.Repeater.Runners; namespace SecTester.Repeater.Extensions; @@ -24,8 +20,6 @@ public static IServiceCollection AddSecTesterRepeater(this IServiceCollection co collection .AddSingleton(options) .AddHttpCommandDispatcher() - .AddSingleton(new ExponentialBackoffOptions()) - .AddSingleton() .AddSingleton() .AddScoped() .AddScoped() @@ -76,42 +70,5 @@ private static void ConfigureHttpClientForHttpRequestRunner(IServiceProvider sp, } } - private static IServiceCollection AddHttpCommandDispatcher(this IServiceCollection collection) => - collection - .AddScoped(sp => - { - var config = sp.GetRequiredService(); - return new HttpCommandDispatcherConfig(config.Api, config.Credentials!.Token, TimeSpan.FromSeconds(10)); - }) - .AddScoped() - .AddScoped(sp => sp.GetRequiredService()) - .AddHttpClientForHttpCommandDispatcher(); - - private static IServiceCollection AddHttpClientForHttpCommandDispatcher(this IServiceCollection collection) - { - collection - .AddHttpClient(nameof(HttpCommandDispatcher), ConfigureHttpClientForHttpCommandDispatcher) - .ConfigurePrimaryHttpMessageHandler(CreateHttpMessageHandlerForHttpCommandDispatcher); - return collection; - } - - private static HttpMessageHandler CreateHttpMessageHandlerForHttpCommandDispatcher() - { - var options = new FixedWindowRateLimiterOptions - { - Window = TimeSpan.FromSeconds(60), - PermitLimit = 10, - QueueLimit = 5 - }; - var rateLimiter = new FixedWindowRateLimiter(options); - - return new RateLimitedHandler(rateLimiter); - } - - private static void ConfigureHttpClientForHttpCommandDispatcher(IServiceProvider sp, HttpClient client) - { - var config = sp.GetRequiredService(); - client.Timeout = (TimeSpan)config.Timeout!; - } } diff --git a/src/SecTester.Repeater/Internal/MessagePackHttpMethodFormatter.cs b/src/SecTester.Repeater/Internal/MessagePackHttpMethodFormatter.cs index 0fc6569..dec388a 100644 --- a/src/SecTester.Repeater/Internal/MessagePackHttpMethodFormatter.cs +++ b/src/SecTester.Repeater/Internal/MessagePackHttpMethodFormatter.cs @@ -1,6 +1,7 @@ using System.Net.Http; using MessagePack; using MessagePack.Formatters; +using SecTester.Core.Internal; namespace SecTester.Repeater.Internal; diff --git a/src/SecTester.Repeater/SecTester.Repeater.csproj b/src/SecTester.Repeater/SecTester.Repeater.csproj index 97d1f41..4a83f72 100644 --- a/src/SecTester.Repeater/SecTester.Repeater.csproj +++ b/src/SecTester.Repeater/SecTester.Repeater.csproj @@ -9,24 +9,15 @@ - - - - - - - - - + - diff --git a/src/SecTester.Repeater/packages.lock.json b/src/SecTester.Repeater/packages.lock.json index d47533b..7c46030 100644 --- a/src/SecTester.Repeater/packages.lock.json +++ b/src/SecTester.Repeater/packages.lock.json @@ -2,25 +2,6 @@ "version": 1, "dependencies": { ".NETStandard,Version=v2.0": { - "Macross.Json.Extensions": { - "type": "Direct", - "requested": "[3.0.0, )", - "resolved": "3.0.0", - "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", - "dependencies": { - "System.Reflection.Emit.Lightweight": "4.7.0", - "System.Text.Json": "6.0.0" - } - }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Direct", "requested": "[6.0.0, )", @@ -31,18 +12,6 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, - "Microsoft.Extensions.Http": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", - "Microsoft.Extensions.Logging": "6.0.0", - "Microsoft.Extensions.Logging.Abstractions": "6.0.0", - "Microsoft.Extensions.Options": "6.0.0" - } - }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -74,38 +43,13 @@ "System.Collections": "4.3.0" } }, - "System.Linq.Async": { - "type": "Direct", - "requested": "[6.0.1, )", - "resolved": "6.0.1", - "contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "6.0.0" - } - }, - "System.Text.Json": { - "type": "Direct", - "requested": "[7.0.3, )", - "resolved": "7.0.3", - "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "7.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.5", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Threading.RateLimiting": { - "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", + "Macross.Json.Extensions": { + "type": "Transitive", + "resolved": "3.0.0", + "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" + "System.Reflection.Emit.Lightweight": "4.7.0", + "System.Text.Json": "6.0.0" } }, "MessagePack": { @@ -128,6 +72,14 @@ "resolved": "2.5.124", "contentHash": "YTWbSjVlMhe6WaEQ953rrNagRzQxDrp9mCB3W2Yr1TOITlaEv/ZMFvqZSabSs09Gy86Kq7BmvcxKTodv/YNDQA==" }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, "Microsoft.Extensions.Configuration": { "type": "Transitive", "resolved": "6.0.0", @@ -164,6 +116,17 @@ "System.Threading.Tasks.Extensions": "4.5.4" } }, + "Microsoft.Extensions.Http": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "6.0.0", @@ -327,6 +290,14 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "System.Linq.Async": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, "System.Memory": { "type": "Transitive", "resolved": "4.5.5", @@ -387,6 +358,29 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Threading.RateLimiting": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, "System.Threading.Tasks.Extensions": { "type": "Transitive", "resolved": "4.5.4", @@ -398,9 +392,15 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } } } diff --git a/src/SecTester.Reporter/packages.lock.json b/src/SecTester.Reporter/packages.lock.json index 4835eed..6a6a4d4 100644 --- a/src/SecTester.Reporter/packages.lock.json +++ b/src/SecTester.Reporter/packages.lock.json @@ -390,24 +390,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.scan": { diff --git a/src/SecTester.Runner/packages.lock.json b/src/SecTester.Runner/packages.lock.json index aed97d1..185d888 100644 --- a/src/SecTester.Runner/packages.lock.json +++ b/src/SecTester.Runner/packages.lock.json @@ -390,24 +390,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.reporter": { diff --git a/src/SecTester.Scan/Commands/CreateScan.cs b/src/SecTester.Scan/Commands/CreateScan.cs index 0a57a0e..0ea8feb 100644 --- a/src/SecTester.Scan/Commands/CreateScan.cs +++ b/src/SecTester.Scan/Commands/CreateScan.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Text; -using SecTester.Repeater.Commands; -using SecTester.Repeater.Dispatchers; +using SecTester.Core.Commands; +using SecTester.Core.Dispatchers; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/DeleteScan.cs b/src/SecTester.Scan/Commands/DeleteScan.cs index 88008e9..278b029 100644 --- a/src/SecTester.Scan/Commands/DeleteScan.cs +++ b/src/SecTester.Scan/Commands/DeleteScan.cs @@ -1,5 +1,5 @@ using SecTester.Core; -using SecTester.Repeater.Commands; +using SecTester.Core.Commands; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/GetScan.cs b/src/SecTester.Scan/Commands/GetScan.cs index 979d829..f5c2263 100644 --- a/src/SecTester.Scan/Commands/GetScan.cs +++ b/src/SecTester.Scan/Commands/GetScan.cs @@ -1,4 +1,4 @@ -using SecTester.Repeater.Commands; +using SecTester.Core.Commands; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/ListIssues.cs b/src/SecTester.Scan/Commands/ListIssues.cs index 171fd7c..f14d2cb 100644 --- a/src/SecTester.Scan/Commands/ListIssues.cs +++ b/src/SecTester.Scan/Commands/ListIssues.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using SecTester.Repeater.Commands; +using SecTester.Core.Commands; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/StopScan.cs b/src/SecTester.Scan/Commands/StopScan.cs index 60e6a82..88b83bc 100644 --- a/src/SecTester.Scan/Commands/StopScan.cs +++ b/src/SecTester.Scan/Commands/StopScan.cs @@ -1,5 +1,5 @@ using SecTester.Core; -using SecTester.Repeater.Commands; +using SecTester.Core.Commands; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/Commands/UploadHar.cs b/src/SecTester.Scan/Commands/UploadHar.cs index b51e270..1d19731 100644 --- a/src/SecTester.Scan/Commands/UploadHar.cs +++ b/src/SecTester.Scan/Commands/UploadHar.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Net.Http; using System.Text; -using SecTester.Repeater.Commands; -using SecTester.Repeater.Dispatchers; +using SecTester.Core.Commands; +using SecTester.Core.Dispatchers; using SecTester.Scan.Models; namespace SecTester.Scan.Commands; diff --git a/src/SecTester.Scan/packages.lock.json b/src/SecTester.Scan/packages.lock.json index 5abaabc..492bbbc 100644 --- a/src/SecTester.Scan/packages.lock.json +++ b/src/SecTester.Scan/packages.lock.json @@ -392,24 +392,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } } } diff --git a/test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs b/test/SecTester.Core.Tests/Dispatchers/HttpCommandDispatcherTests.cs similarity index 98% rename from test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs rename to test/SecTester.Core.Tests/Dispatchers/HttpCommandDispatcherTests.cs index dbfc6ef..40d222b 100644 --- a/test/SecTester.Repeater.Tests/Dispatchers/HttpCommandDispatcherTests.cs +++ b/test/SecTester.Core.Tests/Dispatchers/HttpCommandDispatcherTests.cs @@ -1,6 +1,9 @@ -using SecTester.Repeater.Tests.Fixtures; +using System.Net; +using System.Net.Http.Json; -namespace SecTester.Repeater.Tests.Dispatchers; +using SecTester.Core.Tests.Fixtures; + +namespace SecTester.Core.Tests.Dispatchers; public class HttpCommandDispatcherTests : IDisposable { diff --git a/test/SecTester.Core.Tests/Dispatchers/MessageSerializerTests.cs b/test/SecTester.Core.Tests/Dispatchers/MessageSerializerTests.cs new file mode 100644 index 0000000..601ec1c --- /dev/null +++ b/test/SecTester.Core.Tests/Dispatchers/MessageSerializerTests.cs @@ -0,0 +1,201 @@ +using SecTester.Core.Tests.Fixtures; + + +namespace SecTester.Core.Tests.Dispatchers; + +public class MessageSerializerTests +{ + + public static readonly IEnumerable HttpMethodEnumerable = new List + { + new object[] { HttpMethod.Delete, @"""DELETE""" }, + new object[] { HttpMethod.Get, @"""GET""" }, + new object[] { HttpMethod.Head, @"""HEAD""" }, + new object[] { HttpMethod.Options, @"""OPTIONS""" }, + new object[] { HttpMethod.Patch, @"""PATCH""" }, + new object[] { HttpMethod.Post, @"""POST""" }, + new object[] { HttpMethod.Put, @"""PUT""" }, + new object[] { HttpMethod.Trace, @"""TRACE""" }, + new object[] { new HttpMethod("COPY"), @"""COPY""" }, + new object[] { new HttpMethod("LINK"), @"""LINK""" }, + new object[] { new HttpMethod("UNLINK"), @"""UNLINK""" }, + new object[] { new HttpMethod("PURGE"), @"""PURGE""" }, + new object[] { new HttpMethod("LOCK"), @"""LOCK""" }, + new object[] { new HttpMethod("UNLOCK"), @"""UNLOCK""" }, + new object[] { new HttpMethod("PROPFIND"), @"""PROPFIND""" }, + new object[] { new HttpMethod("VIEW"), @"""VIEW""" } + }; + + public static readonly IEnumerable Headers = new List + { + new object[] + { + new FooBaz(new List>> { new("user-agent", new List { "foo" }) }), + @"{""headers"":{""user-agent"":""foo""}}", + }, + new object[] + { + new FooBaz(new List>> { new("user-agent", new List { "foo", "bar" }) }), + @"{""headers"":{""user-agent"":[""foo"",""bar""]}}", + }, + new object[] + { + new FooBaz(new List>> { new("user-agent", new List { "foo", null! }) }), + @"{""headers"":{""user-agent"":[""foo"",null]}}", + }, + new object[] + { + new FooBaz(new List>>()), + @"{""headers"":{}}", + } + }; + public static IEnumerable Objects => new List + { + new object[] { new { foo = "bar" }, @"{""foo"":""bar""}" }, + new object[] { new { Foo = "bar" }, @"{""foo"":""bar""}" }, + new object[] { new FooBar("bar"), @"{""foo"":""bar""}" } + }; + + public static IEnumerable Strings => new List + { + new object[] { @"{""foo"":""bar""}" }, + new object[] { @"{""Foo"":""bar""}" }, + new object[] { @"{""FoO"":""bar""}" } + }; + + public static IEnumerable EnumValues => new List + { + new object[] { FooEnum.Bar, @"""bar""" }, + new object[] { FooEnum.FooBar, @"""foo_bar""" }, + new object[] { FooEnum.BazQux, @"""baz-qux""" } + }; + + [Theory] + [MemberData(nameof(Objects))] + public void Serialize_GivenInput_ReturnsString(object input, string expected) + { + // act + var result = MessageSerializer.Serialize(input); + + // assert + result.Should().Be(expected); + } + + [Theory] + [MemberData(nameof(Strings))] + public void Deserialize_GivenType_ReturnsObject(string input) + { + // act + var result = MessageSerializer.Deserialize(input, typeof(FooBar)); + + // assert + result.Should().BeOfType(); + result.Should().BeEquivalentTo(new + { + Foo = "bar" + }); + } + + [Theory] + [MemberData(nameof(Strings))] + public void Deserialize_GenericReturnType_ReturnsObject(string input) + { + // act + var result = MessageSerializer.Deserialize(input); + + // assert + result.Should().BeOfType(); + result.Should().BeEquivalentTo(new + { + Foo = "bar" + }); + } + + [Theory] + [MemberData(nameof(EnumValues))] + [MemberData(nameof(HttpMethodEnumerable))] + public void Serialize_GivenEnumValue_ReturnString(object input, string expected) + { + // act + var data = MessageSerializer.Serialize(input); + + // assert + data.Should().Be(expected); + } + + [Theory] + [MemberData(nameof(Headers))] + public void Serialize_GivenKeyValuePairs_ReturnsSerializedHeaders(object input, string expected) + { + // act + var result = MessageSerializer.Serialize(input); + + // assert + result.Should().Be(expected); + } + + [Theory] + [MemberData(nameof(EnumValues))] + [MemberData(nameof(HttpMethodEnumerable))] + public void Deserialize_GivenString_ReturnEnumValue(object expected, string input) + { + // act + var result = MessageSerializer.Deserialize(input, expected.GetType()); + + // assert + result.Should().Be(expected); + } + + [Theory] + [MemberData(nameof(Headers))] + public void Deserialize_GivenSerializedHeaders_ReturnsKeyValuePairs(object expected, string input) + { + // act + var result = MessageSerializer.Deserialize(input, expected.GetType()); + + // assert + result.Should().BeEquivalentTo(expected); + } + + [Fact] + public void Deserialize_GivenMissingFieldInput_ReturnObject() + { + // act + var result = MessageSerializer.Deserialize>("{}"); + + // assert + result.Should().BeOfType>(); + result!.Item1.Should().BeNull(); + } + + [Fact] + public void Deserialize_GivenNullFieldInput_ReturnObject() + { + // act + var result = MessageSerializer.Deserialize>(@"{""item1"":null}"); + + // assert + result.Should().BeOfType>(); + result!.Item1.Should().BeNull(); + } + + [Fact] + public void Deserialize_GivenMissingMember_ThrowError() + { + // act + var act = () => MessageSerializer.Deserialize(@"""FOO""", typeof(HttpMethod)); + + // assert + act.Should().Throw().WithMessage("*FOO*"); + } + + [Fact] + public void Serialize_GivenMissingMember_ThrowError() + { + // act + var act = () => MessageSerializer.Serialize(new HttpMethod("FOO")); + + // assert + act.Should().Throw().WithMessage("*FOO*"); + } +} diff --git a/test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs b/test/SecTester.Core.Tests/Extensions/HttpResponseMessageExtensionsTests.cs similarity index 97% rename from test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs rename to test/SecTester.Core.Tests/Extensions/HttpResponseMessageExtensionsTests.cs index 768ca8c..d91a720 100644 --- a/test/SecTester.Repeater.Tests/Extensions/HttpResponseMessageExtensionsTests.cs +++ b/test/SecTester.Core.Tests/Extensions/HttpResponseMessageExtensionsTests.cs @@ -1,4 +1,7 @@ -namespace SecTester.Repeater.Tests.Extensions; +using System.Net; +using System.Text; + +namespace SecTester.Core.Tests.Extensions; public class HttpResponseMessageExtensionsTests { diff --git a/test/SecTester.Core.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Core.Tests/Extensions/ServiceCollectionExtensionsTests.cs index ebca0eb..033565e 100644 --- a/test/SecTester.Core.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Core.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -4,6 +4,9 @@ public class ServiceCollectionExtensionsTests { private readonly ServiceCollection _services; + private readonly Configuration _config = new("app.brightsec.com", + new Credentials("0zmcwpe.nexr.0vlon8mp7lvxzjuvgjy88olrhadhiukk")); + public ServiceCollectionExtensionsTests() { _services = new ServiceCollection(); @@ -72,4 +75,77 @@ public void AddLogging_GivenLogLevel_SetMinimumLevelToValue() logger.IsEnabled(LogLevel.Information).Should().BeTrue(); logger.IsEnabled(LogLevel.Debug).Should().BeFalse(); } + + + [Fact] + public void AddHttpCommandDispatcher_ReturnHttpCommandDispatcherWithDefaultOptions() + { + // arrange + var services = new ServiceCollection(); + services.AddSecTesterConfig(_config); + + // act + services.AddHttpCommandDispatcher(); + + // assert + using var provider = services.BuildServiceProvider(); + var result = provider.GetRequiredService(); + result.Should().BeOfType(); + } + + [Fact] + public void AddHttpCommandDispatcher_ReturnHttpCommandDispatcherConfig() + { + // arrange + var services = new ServiceCollection(); + services.AddSecTesterConfig(_config); + + // act + services.AddHttpCommandDispatcher(); + + + // assert + using var provider = services.BuildServiceProvider(); + var result = provider.GetRequiredService(); + result.Should().BeEquivalentTo(new + { + BaseUrl = _config.Api, + _config.Credentials!.Token + }); + } + + [Fact] + public void AddHttpCommandDispatcher_ReturnHttpClientWithPreconfiguredTimeout() + { + // arrange + var services = new ServiceCollection(); + services.AddSecTesterConfig(_config); + + // act + services.AddHttpCommandDispatcher(); + + // assert + using var provider = services.BuildServiceProvider(); + var factory = provider.GetRequiredService(); + using var httpClient = factory.CreateClient(nameof(HttpCommandDispatcher)); + httpClient.Should().BeEquivalentTo(new + { + Timeout = TimeSpan.FromSeconds(10) + }); + } + + [Fact] + public void AddHttpCommandDispatcher_ConfigurationIsNotRegistered_ThrowError() + { + // arrange + var services = new ServiceCollection(); + + // act + services.AddHttpCommandDispatcher(); + + // assert + using var provider = services.BuildServiceProvider(); + Func act = () => provider.GetRequiredService(); + act.Should().Throw(); + } } diff --git a/test/SecTester.Repeater.Tests/Fixtures/BazQux.cs b/test/SecTester.Core.Tests/Fixtures/BazQux.cs similarity index 74% rename from test/SecTester.Repeater.Tests/Fixtures/BazQux.cs rename to test/SecTester.Core.Tests/Fixtures/BazQux.cs index 86dad1d..b653d7e 100644 --- a/test/SecTester.Repeater.Tests/Fixtures/BazQux.cs +++ b/test/SecTester.Core.Tests/Fixtures/BazQux.cs @@ -1,4 +1,4 @@ -namespace SecTester.Repeater.Tests.Fixtures; +namespace SecTester.Core.Tests.Fixtures; internal record BazQux { diff --git a/test/SecTester.Repeater.Tests/Fixtures/FooBar.cs b/test/SecTester.Core.Tests/Fixtures/FooBar.cs similarity index 74% rename from test/SecTester.Repeater.Tests/Fixtures/FooBar.cs rename to test/SecTester.Core.Tests/Fixtures/FooBar.cs index 8288146..f516807 100644 --- a/test/SecTester.Repeater.Tests/Fixtures/FooBar.cs +++ b/test/SecTester.Core.Tests/Fixtures/FooBar.cs @@ -1,4 +1,4 @@ -namespace SecTester.Repeater.Tests.Fixtures; +namespace SecTester.Core.Tests.Fixtures; internal record FooBar { diff --git a/test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs b/test/SecTester.Core.Tests/Fixtures/FooBaz.cs similarity index 66% rename from test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs rename to test/SecTester.Core.Tests/Fixtures/FooBaz.cs index 4982ee6..7f6f924 100644 --- a/test/SecTester.Repeater.Tests/Fixtures/FooBaz.cs +++ b/test/SecTester.Core.Tests/Fixtures/FooBaz.cs @@ -1,3 +1,3 @@ -namespace SecTester.Repeater.Tests.Fixtures; +namespace SecTester.Core.Tests.Fixtures; internal record FooBaz(IEnumerable>> Headers); diff --git a/test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs b/test/SecTester.Core.Tests/Fixtures/FooEnum.cs similarity index 73% rename from test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs rename to test/SecTester.Core.Tests/Fixtures/FooEnum.cs index 48aa861..6ed5c9f 100644 --- a/test/SecTester.Repeater.Tests/Fixtures/FooEnum.cs +++ b/test/SecTester.Core.Tests/Fixtures/FooEnum.cs @@ -1,6 +1,6 @@ using System.Runtime.Serialization; -namespace SecTester.Repeater.Tests.Fixtures; +namespace SecTester.Core.Tests.Fixtures; internal enum FooEnum { diff --git a/test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs b/test/SecTester.Core.Tests/Fixtures/IMockInterface.cs similarity index 61% rename from test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs rename to test/SecTester.Core.Tests/Fixtures/IMockInterface.cs index 3da1889..4af51a3 100644 --- a/test/SecTester.Repeater.Tests/Fixtures/IMockInterface.cs +++ b/test/SecTester.Core.Tests/Fixtures/IMockInterface.cs @@ -1,4 +1,4 @@ -namespace SecTester.Repeater.Tests.Fixtures; +namespace SecTester.Core.Tests.Fixtures; internal interface IMockInterface { diff --git a/test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs b/test/SecTester.Core.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs similarity index 96% rename from test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs rename to test/SecTester.Core.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs index 8a90e66..2ba5523 100644 --- a/test/SecTester.Repeater.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs +++ b/test/SecTester.Core.Tests/RetryStrategies/ExponentialBackoffRetryStrategyTests.cs @@ -1,6 +1,8 @@ -using SecTester.Repeater.Tests.Fixtures; +using System.Net; +using System.Net.Sockets; +using SecTester.Core.Tests.Fixtures; -namespace SecTester.Repeater.Tests.RetryStrategies; +namespace SecTester.Core.Tests.RetryStrategies; public class ExponentialBackoffRetryStrategyTests : IDisposable { diff --git a/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj b/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj index 34a7484..01e6686 100644 --- a/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj +++ b/test/SecTester.Core.Tests/SecTester.Core.Tests.csproj @@ -11,8 +11,16 @@ + + + + + + + + diff --git a/test/SecTester.Core.Tests/Usings.cs b/test/SecTester.Core.Tests/Usings.cs index b21d9ac..bc6ca1d 100644 --- a/test/SecTester.Core.Tests/Usings.cs +++ b/test/SecTester.Core.Tests/Usings.cs @@ -1,6 +1,9 @@ global using System; global using System.Collections.Generic; global using System.Globalization; +global using System.Text; +global using System.Text.Json; +global using System.Text.Json.Serialization; global using FluentAssertions; global using FluentAssertions.Extensions; global using Microsoft.Extensions.DependencyInjection; @@ -11,9 +14,15 @@ global using NSubstitute; global using NSubstitute.ClearExtensions; global using NSubstitute.ExceptionExtensions; +global using RichardSzalay.MockHttp; global using SecTester.Core.Bus; +global using SecTester.Core.Commands; global using SecTester.Core.CredentialProviders; +global using SecTester.Core.Dispatchers; +global using SecTester.Core.Exceptions; global using SecTester.Core.Extensions; +global using SecTester.Core.RetryStrategies; +global using SecTester.Core.Exceptions; global using SecTester.Core.Logger; global using SecTester.Core.Utils; global using Xunit; diff --git a/test/SecTester.Core.Tests/packages.lock.json b/test/SecTester.Core.Tests/packages.lock.json index 02027be..7974672 100644 --- a/test/SecTester.Core.Tests/packages.lock.json +++ b/test/SecTester.Core.Tests/packages.lock.json @@ -23,6 +23,17 @@ "System.Configuration.ConfigurationManager": "4.4.0" } }, + "Microsoft.AspNetCore.Mvc.Testing": { + "type": "Direct", + "requested": "[6.0.11, )", + "resolved": "6.0.11", + "contentHash": "fTGSvaCJD+/G/2y26MmHybFG+OfM0qvCeUM5mGEvYPyKORvaS/vYbcD0y1/DFcZ2OJGQmaeq7jBQKHIKgoQVtQ==", + "dependencies": { + "Microsoft.AspNetCore.TestHost": "6.0.11", + "Microsoft.Extensions.DependencyModel": "6.0.0", + "Microsoft.Extensions.Hosting": "6.0.1" + } + }, "Microsoft.Extensions.DependencyInjection": { "type": "Direct", "requested": "[6.0.1, )", @@ -52,6 +63,12 @@ "Castle.Core": "5.0.0" } }, + "RichardSzalay.MockHttp": { + "type": "Direct", + "requested": "[6.0.0, )", + "resolved": "6.0.0", + "contentHash": "bStGNqIX/MGYtML7K3EzdsE/k5HGVAcg7XgN23TQXGXqxNC9fvYFR94fA0sGM5hAT36R+BBGet6ZDQxXL/IPxg==" + }, "xunit": { "type": "Direct", "requested": "[2.4.1, )", @@ -77,6 +94,24 @@ "System.Diagnostics.EventLog": "6.0.0" } }, + "Macross.Json.Extensions": { + "type": "Transitive", + "resolved": "3.0.0", + "contentHash": "AkNshs6dopj8FXsmkkJxvLivN2SyDJQDbjcds5lo9+Y6L4zpcoXdmzXQ3VVN+AIWQr0CTD5A7vkuHGAr2aypZg==" + }, + "Microsoft.AspNetCore.TestHost": { + "type": "Transitive", + "resolved": "6.0.11", + "contentHash": "5K6666GD7d1cERuyjI0jPiUUwdi7+wpueujX/6zxA0xJnNJu7tOHjHj7mFlPbc0SsshEJBhaklI8fMh3Ms+CAw==", + "dependencies": { + "System.IO.Pipelines": "6.0.3" + } + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "3aeMZ1N0lJoSyzqiP03hqemtb1BijhsJADdobn/4nsMJ8V1H+CrpuduUe4hlRdx+ikBQju1VGjMD1GJ3Sk05Eg==" + }, "Microsoft.CodeCoverage": { "type": "Transitive", "resolved": "17.1.0", @@ -130,11 +165,148 @@ "Microsoft.Extensions.Configuration.Abstractions": "6.0.0" } }, + "Microsoft.Extensions.Configuration.CommandLine": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "3nL1qCkZ1Oxx14ZTzgo4MmlO7tso7F+TtMZAY2jUAtTLyAcDp+EDjk3RqafoKiNaePyPvvlleEcBxh3b2Hzl1g==", + "dependencies": { + "Microsoft.Extensions.Configuration": "6.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0" + } + }, + "Microsoft.Extensions.Configuration.EnvironmentVariables": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "pnyXV1LFOsYjGveuC07xp0YHIyGq7jRq5Ncb5zrrIieMLWVwgMyYxcOH0jTnBedDT4Gh1QinSqsjqzcieHk1og==", + "dependencies": { + "Microsoft.Extensions.Configuration": "6.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0" + } + }, + "Microsoft.Extensions.Configuration.FileExtensions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "V4Dth2cYMZpw3HhGw9XUDIijpI6gN+22LDt0AhufIgOppCUfpWX4483OmN+dFXRJkJLc8Tv0Q8QK+1ingT2+KQ==", + "dependencies": { + "Microsoft.Extensions.Configuration": "6.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Physical": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.Configuration.Json": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "GJGery6QytCzS/BxJ96klgG9in3uH26KcUBbiVG/coNDXCRq6LGVVlUT4vXq34KPuM+R2av+LeYdX9h4IZOCUg==", + "dependencies": { + "Microsoft.Extensions.Configuration": "6.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.Configuration.FileExtensions": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "System.Text.Json": "6.0.0" + } + }, + "Microsoft.Extensions.Configuration.UserSecrets": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "Fy8yr4V6obi7ZxvKYI1i85jqtwMq8tqyxQVZpRSkgeA8enqy/KvBIMdcuNdznlxQMZa72mvbHqb7vbg4Pyx95w==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.Configuration.Json": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Physical": "6.0.0" + } + }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", "resolved": "6.0.0", "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "TD5QHg98m3+QhgEV1YVoNMl5KtBw/4rjfxLHO0e/YV9bPUBDKntApP4xdrVtGgCeQZHVfC2EXIGsdpRNrr87Pg==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "6.0.0", + "System.Text.Json": "6.0.0" + } + }, + "Microsoft.Extensions.FileProviders.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "0pd4/fho0gC12rQswaGQxbU34jOS1TPS8lZPpkFCH68ppQjHNHYle9iRuHeev1LhrJ94YPvzcRd8UmIuFk23Qw==", + "dependencies": { + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.FileProviders.Physical": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "QvkL7l0nM8udt3gfyu0Vw8bbCXblxaKOl7c2oBfgGy4LCURRaL9XWZX1FWJrQc43oMokVneVxH38iz+bY1sbhg==", + "dependencies": { + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "Microsoft.Extensions.FileSystemGlobbing": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.FileSystemGlobbing": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw==" + }, + "Microsoft.Extensions.Hosting": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "hbmizc9KPWOacLU8Z8YMaBG6KWdZFppczYV/KwnPGU/8xebWxQxdDeJmLOgg968prb7g2oQgnp6JVLX6lgby8g==", + "dependencies": { + "Microsoft.Extensions.Configuration": "6.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.Configuration.Binder": "6.0.0", + "Microsoft.Extensions.Configuration.CommandLine": "6.0.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1", + "Microsoft.Extensions.Configuration.FileExtensions": "6.0.0", + "Microsoft.Extensions.Configuration.Json": "6.0.0", + "Microsoft.Extensions.Configuration.UserSecrets": "6.0.1", + "Microsoft.Extensions.DependencyInjection": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Physical": "6.0.0", + "Microsoft.Extensions.Hosting.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging.Configuration": "6.0.0", + "Microsoft.Extensions.Logging.Console": "6.0.0", + "Microsoft.Extensions.Logging.Debug": "6.0.0", + "Microsoft.Extensions.Logging.EventLog": "6.0.0", + "Microsoft.Extensions.Logging.EventSource": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, + "Microsoft.Extensions.Hosting.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "GcT5l2CYXL6Sa27KCSh0TixsRfADUgth+ojQSD5EkzisZxmGFh7CwzkcYuGwvmXLjr27uWRNrJ2vuuEjMhU05Q==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0" + } + }, + "Microsoft.Extensions.Http": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0" + } + }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "6.0.0", @@ -180,6 +352,42 @@ "System.Text.Json": "6.0.0" } }, + "Microsoft.Extensions.Logging.Debug": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "M9g/JixseSZATJE9tcMn9uzoD4+DbSglivFqVx8YkRJ7VVPmnvCEbOZ0AAaxsL1EKyI4cz07DXOOJExxNsUOHw==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0" + } + }, + "Microsoft.Extensions.Logging.EventLog": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "rlo0RxlMd0WtLG3CHI0qOTp6fFn7MvQjlrCjucA31RqmiMFCZkF8CHNbe8O7tbBIyyoLGWB1he9CbaA5iyHthg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0", + "System.Diagnostics.EventLog": "6.0.0" + } + }, + "Microsoft.Extensions.Logging.EventSource": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "BeDyyqt7nkm/nr+Gdk+L8n1tUT/u33VkbXAOesgYSNsxDM9hJ1NOBGoZfj9rCbeD2+9myElI6JOVVFmnzgeWQA==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Json": "6.0.0" + } + }, "Microsoft.Extensions.Options": { "type": "Transitive", "resolved": "6.0.0", @@ -449,15 +657,8 @@ }, "System.Buffers": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } + "resolved": "4.5.1", + "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" }, "System.Collections": { "type": "Transitive", @@ -678,6 +879,11 @@ "System.Runtime": "4.3.0" } }, + "System.IO.Pipelines": { + "type": "Transitive", + "resolved": "6.0.3", + "contentHash": "ryTgF+iFkpGZY1vRQhfCzX0xTdlV3pyaTTqRu2ETbEv+HlV7O6y7hyQURnghNIXvctl5DuZ//Dpks6HdL/Txgw==" + }, "System.Linq": { "type": "Transitive", "resolved": "4.3.0", @@ -690,6 +896,14 @@ "System.Runtime.Extensions": "4.3.0" } }, + "System.Linq.Async": { + "type": "Transitive", + "resolved": "6.0.1", + "contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "6.0.0" + } + }, "System.Linq.Expressions": { "type": "Transitive", "resolved": "4.3.0", @@ -714,6 +928,11 @@ "System.Threading": "4.3.0" } }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" + }, "System.Net.Http": { "type": "Transitive", "resolved": "4.3.0", @@ -1128,19 +1347,19 @@ }, "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Text.Json": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "resolved": "7.0.3", + "contentHash": "AyjhwXN1zTFeIibHimfJn6eAsZ7rTBib79JQpzg8WAuR/HKDu9JGNHTuu3nbbXQ/bgI+U4z6HtZmCHNXB1QXrQ==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encodings.Web": "6.0.0" + "System.Text.Encodings.Web": "7.0.0" } }, "System.Text.RegularExpressions": { @@ -1160,6 +1379,11 @@ "System.Threading.Tasks": "4.3.0" } }, + "System.Threading.RateLimiting": { + "type": "Transitive", + "resolved": "7.0.0", + "contentHash": "1vzNiIzf11QzIcqTLf9d9+DcLt2xVT9XtP4pB/ahHngVH1VKEQ+S6yhpFlipb7JxM8VMUK9IBNlsDwWj0vUOTQ==" + }, "System.Threading.Tasks": { "type": "Transitive", "resolved": "4.3.0", @@ -1279,9 +1503,15 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } } } diff --git a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs index ece222d..91e4b39 100644 --- a/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Repeater.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -3,8 +3,6 @@ namespace SecTester.Repeater.Tests.Extensions; public class ServiceCollectionExtensionsTests : IDisposable { private readonly ServiceCollection _sut = Substitute.ForPartsOf(); - private readonly Configuration _config = new("app.brightsec.com", - new Credentials("0zmcwpe.nexr.0vlon8mp7lvxzjuvgjy88olrhadhiukk")); public void Dispose() { @@ -126,69 +124,4 @@ public void AddSecTesterRepeater_WithExtraHeaders_RegistersHttpClient() client.DefaultRequestHeaders.Should().BeEquivalentTo(headers); } - - [Fact] - public void AddSecTesterRepeater_ReturnHttpCommandDispatcherWithDefaultOptions() - { - // arrange - _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _sut.AddSecTesterRepeater(); - - // assert - using var provider = _sut.BuildServiceProvider(); - var result = provider.GetRequiredService(); - result.Should().BeOfType(); - } - - [Fact] - public void AddSecTesterRepeater_ReturnHttpCommandDispatcherConfig() - { - // arrange - _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _sut.AddSecTesterRepeater(); - - // assert - using var provider = _sut.BuildServiceProvider(); - var result = provider.GetRequiredService(); - result.Should().BeEquivalentTo(new - { - BaseUrl = _config.Api, - _config.Credentials!.Token - }); - } - - [Fact] - public void AddSecTesterRepeater_ReturnHttpClientWithPreconfiguredTimeout() - { - // arrange - _sut.Add(new ServiceDescriptor(typeof(Configuration), _config)); - - // act - _sut.AddSecTesterRepeater(); - - // assert - using var provider = _sut.BuildServiceProvider(); - var factory = provider.GetRequiredService(); - using var httpClient = factory.CreateClient(nameof(HttpCommandDispatcher)); - httpClient.Should().BeEquivalentTo(new - { - Timeout = TimeSpan.FromSeconds(10) - }); - } - - [Fact] - public void AddSecTesterRepeater_ConfigurationIsNotRegistered_ThrowError() - { - // act - _sut.AddSecTesterRepeater(); - - // assert - using var provider = _sut.BuildServiceProvider(); - Func act = () => provider.GetRequiredService(); - act.Should().Throw(); - } } diff --git a/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs deleted file mode 100644 index 4a50649..0000000 --- a/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SecTester.Repeater.Tests.Fixtures; - -internal record ConcreteCommand : Command -{ - public string Payload { get; } - - public ConcreteCommand(string payload, bool? expectReply = null, TimeSpan? ttl = null) : base(expectReply, ttl) => Payload = payload; -} diff --git a/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs b/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs deleted file mode 100644 index 2624188..0000000 --- a/test/SecTester.Repeater.Tests/Fixtures/ConcreteCommand2.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SecTester.Repeater.Tests.Fixtures; - -internal record ConcreteCommand2 : Command -{ - public string Payload { get; } - - public ConcreteCommand2(string payload, bool? expectReply = null, TimeSpan? ttl = null) : base(expectReply, ttl) => Payload = payload; -} diff --git a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj index 74187c4..82dcde5 100644 --- a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj +++ b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj @@ -6,7 +6,6 @@ - diff --git a/test/SecTester.Repeater.Tests/Usings.cs b/test/SecTester.Repeater.Tests/Usings.cs index cd2b35c..6b72f15 100644 --- a/test/SecTester.Repeater.Tests/Usings.cs +++ b/test/SecTester.Repeater.Tests/Usings.cs @@ -17,16 +17,15 @@ global using RichardSzalay.MockHttp; global using SecTester.Core; global using SecTester.Core.Bus; +global using SecTester.Core.Commands; +global using SecTester.Core.Dispatchers; global using SecTester.Core.Exceptions; +global using SecTester.Core.RetryStrategies; global using SecTester.Core.Logger; global using SecTester.Core.Utils; global using SecTester.Repeater.Api; global using SecTester.Repeater.Bus; -global using SecTester.Repeater.Commands; -global using SecTester.Repeater.Dispatchers; -global using SecTester.Repeater.Exceptions; global using SecTester.Repeater.Extensions; -global using SecTester.Repeater.RetryStrategies; global using SecTester.Repeater.Runners; global using SecTester.Repeater.Tests.Mocks; global using Xunit; diff --git a/test/SecTester.Repeater.Tests/packages.lock.json b/test/SecTester.Repeater.Tests/packages.lock.json index c514f5c..e495369 100644 --- a/test/SecTester.Repeater.Tests/packages.lock.json +++ b/test/SecTester.Repeater.Tests/packages.lock.json @@ -1570,24 +1570,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.scan": { diff --git a/test/SecTester.Reporter.Tests/packages.lock.json b/test/SecTester.Reporter.Tests/packages.lock.json index 81b1c79..24201d8 100644 --- a/test/SecTester.Reporter.Tests/packages.lock.json +++ b/test/SecTester.Reporter.Tests/packages.lock.json @@ -1385,24 +1385,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.reporter": { diff --git a/test/SecTester.Runner.Tests/packages.lock.json b/test/SecTester.Runner.Tests/packages.lock.json index 0921f01..7a679a2 100644 --- a/test/SecTester.Runner.Tests/packages.lock.json +++ b/test/SecTester.Runner.Tests/packages.lock.json @@ -1385,24 +1385,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.reporter": { diff --git a/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs b/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs index 080c14b..a834728 100644 --- a/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs +++ b/test/SecTester.Scan.Tests/Extensions/ServiceCollectionExtensionsTests.cs @@ -1,4 +1,4 @@ -using SecTester.Core.Extensions; +using SecTester.Repeater.Extensions; namespace SecTester.Scan.Tests.Extensions; diff --git a/test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs b/test/SecTester.Scan.Tests/MessageSerializerTests.cs similarity index 56% rename from test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs rename to test/SecTester.Scan.Tests/MessageSerializerTests.cs index 68793bf..9bb8382 100644 --- a/test/SecTester.Repeater.Tests/Dispatchers/MessageSerializerTests.cs +++ b/test/SecTester.Scan.Tests/MessageSerializerTests.cs @@ -1,7 +1,4 @@ -using SecTester.Repeater.Tests.Fixtures; -using SecTester.Scan.Models; - -namespace SecTester.Repeater.Tests.Dispatchers; +namespace SecTester.Scan.Tests; public class MessageSerializerTests { @@ -24,7 +21,8 @@ public class MessageSerializerTests public static readonly IEnumerable ProtocolEnumerable = new List { - new object[] { Protocol.Http, @"""http""" } + new object[] { Protocol.Http, @"""http""" }, + new object[] { Protocol.Ws, @"""ws""" } }; public static readonly IEnumerable DiscoveryEnumerable = new List @@ -117,113 +115,7 @@ public class MessageSerializerTests new object[] { TestType.Xxe, @"""xxe""" } }; - public static readonly IEnumerable HttpMethodEnumerable = new List - { - new object[] { HttpMethod.Delete, @"""DELETE""" }, - new object[] { HttpMethod.Get, @"""GET""" }, - new object[] { HttpMethod.Head, @"""HEAD""" }, - new object[] { HttpMethod.Options, @"""OPTIONS""" }, - new object[] { HttpMethod.Patch, @"""PATCH""" }, - new object[] { HttpMethod.Post, @"""POST""" }, - new object[] { HttpMethod.Put, @"""PUT""" }, - new object[] { HttpMethod.Trace, @"""TRACE""" }, - new object[] { new HttpMethod("COPY"), @"""COPY""" }, - new object[] { new HttpMethod("LINK"), @"""LINK""" }, - new object[] { new HttpMethod("UNLINK"), @"""UNLINK""" }, - new object[] { new HttpMethod("PURGE"), @"""PURGE""" }, - new object[] { new HttpMethod("LOCK"), @"""LOCK""" }, - new object[] { new HttpMethod("UNLOCK"), @"""UNLOCK""" }, - new object[] { new HttpMethod("PROPFIND"), @"""PROPFIND""" }, - new object[] { new HttpMethod("VIEW"), @"""VIEW""" } - }; - - public static readonly IEnumerable Headers = new List - { - new object[] - { - new FooBaz(new List>> { new("user-agent", new List { "foo" }) }), - @"{""headers"":{""user-agent"":""foo""}}", - }, - new object[] - { - new FooBaz(new List>> { new("user-agent", new List { "foo", "bar" }) }), - @"{""headers"":{""user-agent"":[""foo"",""bar""]}}", - }, - new object[] - { - new FooBaz(new List>> { new("user-agent", new List { "foo", null! }) }), - @"{""headers"":{""user-agent"":[""foo"",null]}}", - }, - new object[] - { - new FooBaz(new List>>()), - @"{""headers"":{}}", - } - }; - public static IEnumerable Objects => new List - { - new object[] { new { foo = "bar" }, @"{""foo"":""bar""}" }, - new object[] { new { Foo = "bar" }, @"{""foo"":""bar""}" }, - new object[] { new FooBar("bar"), @"{""foo"":""bar""}" } - }; - - public static IEnumerable Strings => new List - { - new object[] { @"{""foo"":""bar""}" }, - new object[] { @"{""Foo"":""bar""}" }, - new object[] { @"{""FoO"":""bar""}" } - }; - - public static IEnumerable EnumValues => new List - { - new object[] { FooEnum.Bar, @"""bar""" }, - new object[] { FooEnum.FooBar, @"""foo_bar""" }, - new object[] { FooEnum.BazQux, @"""baz-qux""" } - }; - - [Theory] - [MemberData(nameof(Objects))] - public void Serialize_GivenInput_ReturnsString(object input, string expected) - { - // act - var result = MessageSerializer.Serialize(input); - - // assert - result.Should().Be(expected); - } - [Theory] - [MemberData(nameof(Strings))] - public void Deserialize_GivenType_ReturnsObject(string input) - { - // act - var result = MessageSerializer.Deserialize(input, typeof(FooBar)); - - // assert - result.Should().BeOfType(); - result.Should().BeEquivalentTo(new - { - Foo = "bar" - }); - } - - [Theory] - [MemberData(nameof(Strings))] - public void Deserialize_GenericReturnType_ReturnsObject(string input) - { - // act - var result = MessageSerializer.Deserialize(input); - - // assert - result.Should().BeOfType(); - result.Should().BeEquivalentTo(new - { - Foo = "bar" - }); - } - - [Theory] - [MemberData(nameof(EnumValues))] [MemberData(nameof(AttackParamLocationEnumerable))] [MemberData(nameof(FrameEnumerable))] [MemberData(nameof(ProtocolEnumerable))] @@ -232,7 +124,6 @@ public void Deserialize_GenericReturnType_ReturnsObject(string input) [MemberData(nameof(ScanStatusEnumerable))] [MemberData(nameof(SeverityEnumerable))] [MemberData(nameof(TestTypeEnumerable))] - [MemberData(nameof(HttpMethodEnumerable))] public void Serialize_GivenEnumValue_ReturnString(object input, string expected) { // act @@ -242,19 +133,8 @@ public void Serialize_GivenEnumValue_ReturnString(object input, string expected) data.Should().Be(expected); } - [Theory] - [MemberData(nameof(Headers))] - public void Serialize_GivenKeyValuePairs_ReturnsSerializedHeaders(object input, string expected) - { - // act - var result = MessageSerializer.Serialize(input); - - // assert - result.Should().Be(expected); - } [Theory] - [MemberData(nameof(EnumValues))] [MemberData(nameof(AttackParamLocationEnumerable))] [MemberData(nameof(FrameEnumerable))] [MemberData(nameof(ProtocolEnumerable))] @@ -263,7 +143,6 @@ public void Serialize_GivenKeyValuePairs_ReturnsSerializedHeaders(object input, [MemberData(nameof(ScanStatusEnumerable))] [MemberData(nameof(SeverityEnumerable))] [MemberData(nameof(TestTypeEnumerable))] - [MemberData(nameof(HttpMethodEnumerable))] public void Deserialize_GivenString_ReturnEnumValue(object expected, string input) { // act @@ -272,57 +151,4 @@ public void Deserialize_GivenString_ReturnEnumValue(object expected, string inpu // assert result.Should().Be(expected); } - - [Theory] - [MemberData(nameof(Headers))] - public void Deserialize_GivenSerializedHeaders_ReturnsKeyValuePairs(object expected, string input) - { - // act - var result = MessageSerializer.Deserialize(input, expected.GetType()); - - // assert - result.Should().BeEquivalentTo(expected); - } - - [Fact] - public void Deserialize_GivenMissingFieldInput_ReturnObject() - { - // act - var result = MessageSerializer.Deserialize>("{}"); - - // assert - result.Should().BeOfType>(); - result!.Item1.Should().BeNull(); - } - - [Fact] - public void Deserialize_GivenNullFieldInput_ReturnObject() - { - // act - var result = MessageSerializer.Deserialize>(@"{""item1"":null}"); - - // assert - result.Should().BeOfType>(); - result!.Item1.Should().BeNull(); - } - - [Fact] - public void Deserialize_GivenMissingMember_ThrowError() - { - // act - var act = () => MessageSerializer.Deserialize(@"""FOO""", typeof(HttpMethod)); - - // assert - act.Should().Throw().WithMessage("*FOO*"); - } - - [Fact] - public void Serialize_GivenMissingMember_ThrowError() - { - // act - var act = () => MessageSerializer.Serialize(new HttpMethod("FOO")); - - // assert - act.Should().Throw().WithMessage("*FOO*"); - } } diff --git a/test/SecTester.Scan.Tests/Usings.cs b/test/SecTester.Scan.Tests/Usings.cs index b1bc4bc..94bcba8 100644 --- a/test/SecTester.Scan.Tests/Usings.cs +++ b/test/SecTester.Scan.Tests/Usings.cs @@ -14,8 +14,8 @@ global using SecTester.Core.Bus; global using SecTester.Core.Exceptions; global using SecTester.Core.Utils; -global using SecTester.Repeater.Dispatchers; -global using SecTester.Repeater.Extensions; +global using SecTester.Core.Dispatchers; +global using SecTester.Core.Extensions; global using SecTester.Scan.CI; global using SecTester.Scan.Commands; global using SecTester.Scan.Exceptions; diff --git a/test/SecTester.Scan.Tests/packages.lock.json b/test/SecTester.Scan.Tests/packages.lock.json index 7f06915..cbb37aa 100644 --- a/test/SecTester.Scan.Tests/packages.lock.json +++ b/test/SecTester.Scan.Tests/packages.lock.json @@ -1386,24 +1386,24 @@ "sectester.core": { "type": "Project", "dependencies": { + "Macross.Json.Extensions": "[3.0.0, )", + "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", + "Microsoft.Extensions.Http": "[6.0.0, )", "Microsoft.Extensions.Logging": "[6.0.0, )", - "Microsoft.Extensions.Logging.Console": "[6.0.0, )" + "Microsoft.Extensions.Logging.Console": "[6.0.0, )", + "System.Linq.Async": "[6.0.1, )", + "System.Text.Json": "[7.0.3, )", + "System.Threading.RateLimiting": "[7.0.0, )" } }, "sectester.repeater": { "type": "Project", "dependencies": { - "Macross.Json.Extensions": "[3.0.0, )", - "Microsoft.Bcl.AsyncInterfaces": "[7.0.0, )", "Microsoft.Extensions.DependencyInjection.Abstractions": "[6.0.0, )", - "Microsoft.Extensions.Http": "[6.0.0, )", "SecTester.Core": "[0.41.4, )", "SocketIO.Serializer.MessagePack": "[3.1.2, )", - "SocketIOClient": "[3.1.1, )", - "System.Linq.Async": "[6.0.1, )", - "System.Text.Json": "[7.0.3, )", - "System.Threading.RateLimiting": "[7.0.0, )" + "SocketIOClient": "[3.1.1, )" } }, "sectester.scan": { From 48fb2174e326794234e5a839eb96fe50bc49e49c Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Mon, 17 Jun 2024 14:33:26 +0700 Subject: [PATCH 5/6] feat(repeater): address pr comments closes #172 --- test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj index 82dcde5..b325622 100644 --- a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj +++ b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj @@ -11,7 +11,7 @@ - + From 155536e2219dba7d6dfade5392492982872636aa Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Mon, 17 Jun 2024 16:37:28 +0700 Subject: [PATCH 6/6] feat(repeater): address pr comments closes #172 --- test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj index b325622..ad694f3 100644 --- a/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj +++ b/test/SecTester.Repeater.Tests/SecTester.Repeater.Tests.csproj @@ -11,7 +11,7 @@ - +