From 796a5170562acad67123d4e0acfb213fbaff3ab5 Mon Sep 17 00:00:00 2001 From: Craig Edmunds Date: Wed, 18 Dec 2024 15:16:06 +0000 Subject: [PATCH] Tidied up code errors --- .../Fixtures/BasicSampleDataTestFixture.cs | 6 +----- .../Fixtures/MultiItemDataTestFixture.cs | 7 ------- .../Helpers/TestDataGeneratorHelpers.cs | 10 ++-------- .../Scenarios/CRNoMatchScenarioGenerator.cs | 1 - .../Scenarios/ChedAManyCommoditiesScenarioGenerator.cs | 1 - .../Scenarios/ChedANoMatchScenarioGenerator.cs | 1 - .../Scenarios/ChedASimpleMatchScenarioGenerator.cs | 1 - 7 files changed, 3 insertions(+), 24 deletions(-) diff --git a/Btms.Analytics.Tests/Fixtures/BasicSampleDataTestFixture.cs b/Btms.Analytics.Tests/Fixtures/BasicSampleDataTestFixture.cs index 53117989..312e43d8 100644 --- a/Btms.Analytics.Tests/Fixtures/BasicSampleDataTestFixture.cs +++ b/Btms.Analytics.Tests/Fixtures/BasicSampleDataTestFixture.cs @@ -13,9 +13,7 @@ public class BasicSampleDataTestFixture : IDisposable #pragma warning restore S3881 { public IHost App; - // public IImportNotificationsAggregationService ImportNotificationsAggregationService; - // public IMovementsAggregationService MovementsAggregationService; - + private readonly IMongoDbContext _mongoDbContext; private readonly ILogger _logger; public BasicSampleDataTestFixture(IMessageSink messageSink) @@ -28,8 +26,6 @@ public BasicSampleDataTestFixture(IMessageSink messageSink) var rootScope = App.Services.CreateScope(); _mongoDbContext = rootScope.ServiceProvider.GetRequiredService(); - // ImportNotificationsAggregationService = rootScope.ServiceProvider.GetRequiredService(); - // MovementsAggregationService = rootScope.ServiceProvider.GetRequiredService(); // Would like to pick this up from env/config/DB state var insertToMongo = true; diff --git a/Btms.Analytics.Tests/Fixtures/MultiItemDataTestFixture.cs b/Btms.Analytics.Tests/Fixtures/MultiItemDataTestFixture.cs index 5c953d36..f39295c1 100644 --- a/Btms.Analytics.Tests/Fixtures/MultiItemDataTestFixture.cs +++ b/Btms.Analytics.Tests/Fixtures/MultiItemDataTestFixture.cs @@ -1,8 +1,5 @@ -using Bogus; using Btms.Analytics.Tests.Helpers; using Btms.Backend.Data; -using Btms.SyncJob.Extensions; -using MartinCostello.Logging.XUnit; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using TestDataGenerator.Scenarios; @@ -47,10 +44,6 @@ public MultiItemDataTestFixture(IMessageSink messageSink) app.PushToConsumers(_logger, app.CreateScenarioConfig(1, 1, arrivalDateRange: 0)) .GetAwaiter().GetResult(); - - - - // var result = app.Services.WaitOnAllJobs(_logger).GetAwaiter().GetResult(); } } diff --git a/Btms.Analytics.Tests/Helpers/TestDataGeneratorHelpers.cs b/Btms.Analytics.Tests/Helpers/TestDataGeneratorHelpers.cs index c39fc62f..aaba1842 100644 --- a/Btms.Analytics.Tests/Helpers/TestDataGeneratorHelpers.cs +++ b/Btms.Analytics.Tests/Helpers/TestDataGeneratorHelpers.cs @@ -31,17 +31,14 @@ public static async Task PushToConsumers(this IHost app, ILogger logger, foreach (var message in generatorResult) { var scope = app.Services.CreateScope(); - // var topic = string.Empty; - // var headers = new Dictionary(); - + switch (message) { case null: throw new ArgumentNullException(); case ImportNotification n: - // topic = "NOTIFICATIONS"; - // headers.Add("messageId", n.ReferenceNumber!); + var notificationConsumer = (NotificationConsumer)scope .ServiceProvider .GetRequiredService>(); @@ -88,8 +85,6 @@ public static async Task PushToConsumers(this IHost app, ILogger logger, default: throw new ArgumentException($"Unexpected type {message.GetType().Name}"); } - - // await bus.Publish(message, topic, headers); } } @@ -98,7 +93,6 @@ public static async Task PushToConsumers(this IHost app, ILogger logger, private static ScenarioGenerator.GeneratorResult[] Generate(this IHost app, ILogger logger, ScenarioConfig scenario) { - // var logger = app.Services.GetRequiredService>(); var days = scenario.CreationDateRange; var count = scenario.Count; var generator = scenario.Generator; diff --git a/TestDataGenerator/Scenarios/CRNoMatchScenarioGenerator.cs b/TestDataGenerator/Scenarios/CRNoMatchScenarioGenerator.cs index beca98a8..b7f7697f 100644 --- a/TestDataGenerator/Scenarios/CRNoMatchScenarioGenerator.cs +++ b/TestDataGenerator/Scenarios/CRNoMatchScenarioGenerator.cs @@ -19,6 +19,5 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD logger.LogInformation("Created {EntryReference}", clearanceRequest.Header!.EntryReference); return new GeneratorResult([clearanceRequest]); - // return new GeneratorResult { ClearanceRequests = [clearanceRequest], ImportNotifications = [] }; } } \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/ChedAManyCommoditiesScenarioGenerator.cs b/TestDataGenerator/Scenarios/ChedAManyCommoditiesScenarioGenerator.cs index 0d029839..77ebc4bf 100644 --- a/TestDataGenerator/Scenarios/ChedAManyCommoditiesScenarioGenerator.cs +++ b/TestDataGenerator/Scenarios/ChedAManyCommoditiesScenarioGenerator.cs @@ -27,7 +27,6 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD logger.LogInformation("Created {EntryReference}", clearanceRequest.Header!.EntryReference); return new GeneratorResult([clearanceRequest, notification]); - // return new GeneratorResult { ClearanceRequests = [clearanceRequest], ImportNotifications = [notification] }; } } \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs b/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs index 3a4ef2c9..507ed9f3 100644 --- a/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs +++ b/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs @@ -17,6 +17,5 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD notification.ReferenceNumber); return new GeneratorResult([notification]); - // return new GeneratorResult { ClearanceRequests = [], ImportNotifications = [notification] }; } } \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/ChedASimpleMatchScenarioGenerator.cs b/TestDataGenerator/Scenarios/ChedASimpleMatchScenarioGenerator.cs index 4a84c0d7..e9831296 100644 --- a/TestDataGenerator/Scenarios/ChedASimpleMatchScenarioGenerator.cs +++ b/TestDataGenerator/Scenarios/ChedASimpleMatchScenarioGenerator.cs @@ -25,6 +25,5 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD logger.LogInformation("Created {EntryReference}", clearanceRequest.Header!.EntryReference); return new GeneratorResult([clearanceRequest, notification]); - // return new GeneratorResult { ClearanceRequests = [clearanceRequest], ImportNotifications = [notification] }; } } \ No newline at end of file