Skip to content

Commit

Permalink
Tidied up code errors
Browse files Browse the repository at this point in the history
  • Loading branch information
craigedmunds committed Dec 18, 2024
1 parent 7069677 commit 796a517
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 24 deletions.
6 changes: 1 addition & 5 deletions Btms.Analytics.Tests/Fixtures/BasicSampleDataTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MultiItemDataTestFixture> _logger;
public BasicSampleDataTestFixture(IMessageSink messageSink)
Expand All @@ -28,8 +26,6 @@ public BasicSampleDataTestFixture(IMessageSink messageSink)
var rootScope = App.Services.CreateScope();

_mongoDbContext = rootScope.ServiceProvider.GetRequiredService<IMongoDbContext>();
// ImportNotificationsAggregationService = rootScope.ServiceProvider.GetRequiredService<IImportNotificationsAggregationService>();
// MovementsAggregationService = rootScope.ServiceProvider.GetRequiredService<IMovementsAggregationService>();

// Would like to pick this up from env/config/DB state
var insertToMongo = true;
Expand Down
7 changes: 0 additions & 7 deletions Btms.Analytics.Tests/Fixtures/MultiItemDataTestFixture.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -47,10 +44,6 @@ public MultiItemDataTestFixture(IMessageSink messageSink)

app.PushToConsumers(_logger, app.CreateScenarioConfig<ChedPSimpleMatchScenarioGenerator>(1, 1, arrivalDateRange: 0))
.GetAwaiter().GetResult();



// var result = app.Services.WaitOnAllJobs(_logger).GetAwaiter().GetResult();
}
}

Expand Down
10 changes: 2 additions & 8 deletions Btms.Analytics.Tests/Helpers/TestDataGeneratorHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@ public static async Task<IHost> PushToConsumers(this IHost app, ILogger logger,
foreach (var message in generatorResult)
{
var scope = app.Services.CreateScope();
// var topic = string.Empty;
// var headers = new Dictionary<string, object>();


switch (message)
{
case null:
throw new ArgumentNullException();

case ImportNotification n:
// topic = "NOTIFICATIONS";
// headers.Add("messageId", n.ReferenceNumber!);

var notificationConsumer = (NotificationConsumer)scope
.ServiceProvider
.GetRequiredService<IConsumer<ImportNotification>>();
Expand Down Expand Up @@ -88,8 +85,6 @@ public static async Task<IHost> PushToConsumers(this IHost app, ILogger logger,
default:
throw new ArgumentException($"Unexpected type {message.GetType().Name}");
}

// await bus.Publish(message, topic, headers);
}
}

Expand All @@ -98,7 +93,6 @@ public static async Task<IHost> PushToConsumers(this IHost app, ILogger logger,

private static ScenarioGenerator.GeneratorResult[] Generate(this IHost app, ILogger logger, ScenarioConfig scenario)
{
// var logger = app.Services.GetRequiredService<ILogger<ScenarioGenerator>>();
var days = scenario.CreationDateRange;
var count = scenario.Count;
var generator = scenario.Generator;
Expand Down
1 change: 0 additions & 1 deletion TestDataGenerator/Scenarios/CRNoMatchScenarioGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [] };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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] };

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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] };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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] };
}
}

0 comments on commit 796a517

Please sign in to comment.