diff --git a/Btms.Analytics/MovementsAggregationService.cs b/Btms.Analytics/MovementsAggregationService.cs index 7a6bf1a..387da2a 100644 --- a/Btms.Analytics/MovementsAggregationService.cs +++ b/Btms.Analytics/MovementsAggregationService.cs @@ -6,8 +6,6 @@ using Btms.Model; using MongoDB.Bson; using MongoDB.Driver; -using Btms.Analytics.Extensions; -using Microsoft.EntityFrameworkCore.Query.SqlExpressions; namespace Btms.Analytics; diff --git a/Btms.Business.Tests/Commands/SyncClearanceRequestsCommandTests.cs b/Btms.Business.Tests/Commands/SyncClearanceRequestsCommandTests.cs index 612b77d..f247f4a 100644 --- a/Btms.Business.Tests/Commands/SyncClearanceRequestsCommandTests.cs +++ b/Btms.Business.Tests/Commands/SyncClearanceRequestsCommandTests.cs @@ -17,40 +17,39 @@ namespace Btms.Business.Tests.Commands; public class SyncClearanceRequestsCommandTests(ITestOutputHelper outputHelper) { - [Fact] - public async Task WhenClearanceRequestBlobsExist_ThenTheyShouldBePlacedOnInternalBus() - { - var clearanceRequest = ClearanceRequestBuilder.Default().Build(); - var command = new SyncClearanceRequestsCommand(); - var jobStore = new SyncJobStore(); - jobStore.CreateJob(command.JobId, SyncPeriod.All.ToString(), "ClearanceRequests"); - - - var bus = Substitute.For(); - var blob = Substitute.For(); - blob.GetResourcesAsync(Arg.Any(), Arg.Any()) - .Returns( - new TestBlobItem(clearanceRequest!.Header!.EntryReference!, clearanceRequest.ToJsonString()) - .ToAsyncEnumerator()); - - blob.GetResource(Arg.Any(), Arg.Any()) - .Returns(clearanceRequest.ToJsonString()); - - - var handler = new SyncClearanceRequestsCommand.Handler( - new SyncMetrics(new DummyMeterFactory()), - bus, - TestLogger.Create(outputHelper), - new SensitiveDataSerializer(Options.Create(SensitiveDataOptions.WithSensitiveData), NullLogger.Instance), - blob, - Options.Create(new BusinessOptions()), - jobStore); - - await handler.Handle(command, CancellationToken.None); - - // ASSERT - await bus.Received(1).Publish(Arg.Any(), "CLEARANCEREQUESTS", - Arg.Any>(), Arg.Any()); - } + [Fact] + public async Task WhenClearanceRequestBlobsExist_ThenTheyShouldBePlacedOnInternalBus() + { + var clearanceRequest = ClearanceRequestBuilder.Default().Build(); + var command = new SyncClearanceRequestsCommand(); + var jobStore = new SyncJobStore(); + jobStore.CreateJob(command.JobId, SyncPeriod.All.ToString(), "ClearanceRequests"); + + + var bus = Substitute.For(); + var blob = Substitute.For(); + blob.GetResourcesAsync(Arg.Any(), Arg.Any()) + .Returns( + new TestBlobItem(clearanceRequest.Header!.EntryReference!, clearanceRequest.ToJsonString()) + .ToAsyncEnumerator()); + + blob.GetResource(Arg.Any(), Arg.Any()) + .Returns(clearanceRequest.ToJsonString()); + + + var handler = new SyncClearanceRequestsCommand.Handler( + new SyncMetrics(new DummyMeterFactory()), + bus, + TestLogger.Create(outputHelper), + new SensitiveDataSerializer(Options.Create(SensitiveDataOptions.WithSensitiveData), NullLogger.Instance), + blob, + Options.Create(new BusinessOptions()), + jobStore); + + await handler.Handle(command, CancellationToken.None); + + // ASSERT + await bus.Received(1).Publish(Arg.Any(), "CLEARANCEREQUESTS", + Arg.Any>(), Arg.Any()); } -} \ No newline at end of file +} diff --git a/Btms.Business.Tests/Services/Decisions/Finders/ChedPPDecisionFinderTests.cs b/Btms.Business.Tests/Services/Decisions/Finders/ChedPPDecisionFinderTests.cs index c242a76..0ec8c9c 100644 --- a/Btms.Business.Tests/Services/Decisions/Finders/ChedPPDecisionFinderTests.cs +++ b/Btms.Business.Tests/Services/Decisions/Finders/ChedPPDecisionFinderTests.cs @@ -3,6 +3,7 @@ namespace Btms.Business.Tests.Services.Decisions.Finders; +// ReSharper disable once InconsistentNaming public class ChedPPDecisionFinderTests { [Fact] diff --git a/Btms.Business.Tests/Services/Linking/LinkingServiceTests.cs b/Btms.Business.Tests/Services/Linking/LinkingServiceTests.cs index ff0e02a..02f3735 100644 --- a/Btms.Business.Tests/Services/Linking/LinkingServiceTests.cs +++ b/Btms.Business.Tests/Services/Linking/LinkingServiceTests.cs @@ -16,7 +16,7 @@ namespace Btms.Business.Tests.Services.Linking; public class LinkingServiceTests { - private static readonly Random random = new (); + private static readonly Random Random = new (); private readonly IMongoDbContext dbContext = new MemoryMongoDbContext(); private readonly LinkingMetrics linkingMetrics = new(new DummyMeterFactory()); private static string GenerateDocumentReference(int id) => $"GBCVD2024.{id}"; @@ -295,7 +295,8 @@ private MovementLinkContext CreateMovementContext(Movement? movement, List new Items { Documents = [ new Document { DocumentReference = GenerateDocumentReference(x) } ] - }).ToList() + }).ToList(), + ClearanceRequests = new() }; var existingMovement = createExistingMovement ? @@ -308,7 +309,8 @@ private MovementLinkContext CreateMovementContext(Movement? movement, List(string path, SyncPeriod period, stri var result = blobService.GetResourcesAsync($"{path}{period.GetPeriodPath()}", cancellationToken); var degreeOfParallelism = options.Value.GetConcurrency(BusinessOptions.Feature.BlobItems); - await Parallel.ForEachAsync(result, new ParallelOptions() { CancellationToken = cancellationToken, MaxDegreeOfParallelism = degreeOfParallelism }, async (item, token) => + await Parallel.ForEachAsync(result, new ParallelOptions() { CancellationToken = cancellationToken, MaxDegreeOfParallelism = degreeOfParallelism }, async (item, _) => { await SyncBlob(path, topic, item, job, cancellationToken); }); @@ -121,7 +121,7 @@ protected async Task SyncBlobs(SyncPeriod period, string topic, Guid j var degreeOfParallelism = options.Value.GetConcurrency(BusinessOptions.Feature.BlobItems); job?.Start(); - logger.LogInformation("SyncNotifications period: {Period}, maxDegreeOfParallelism={degreeOfParallelism}, Environment.ProcessorCount={ProcessorCount}", period.ToString(), degreeOfParallelism, Environment.ProcessorCount); + logger.LogInformation("SyncNotifications period: {Period}, maxDegreeOfParallelism={DegreeOfParallelism}, Environment.ProcessorCount={ProcessorCount}", period.ToString(), degreeOfParallelism, Environment.ProcessorCount); try { foreach (var path in paths) diff --git a/Btms.Business/Services/Decisions/Finders/ChedPPDecisionFinder.cs b/Btms.Business/Services/Decisions/Finders/ChedPPDecisionFinder.cs index c9f4265..2518164 100644 --- a/Btms.Business/Services/Decisions/Finders/ChedPPDecisionFinder.cs +++ b/Btms.Business/Services/Decisions/Finders/ChedPPDecisionFinder.cs @@ -2,6 +2,7 @@ namespace Btms.Business.Services.Decisions.Finders; +// ReSharper disable once InconsistentNaming public class ChedPPDecisionFinder : IDecisionFinder { public DecisionResult FindDecision(ImportNotification notification) diff --git a/Btms.Consumers/ConsumerOptions.cs b/Btms.Consumers/ConsumerOptions.cs index 8ea4430..7b64d5a 100644 --- a/Btms.Consumers/ConsumerOptions.cs +++ b/Btms.Consumers/ConsumerOptions.cs @@ -1,6 +1,3 @@ -using System.ComponentModel.DataAnnotations; -using Btms.Azure; - namespace Btms.Consumers; public class ConsumerOptions diff --git a/Btms.Consumers/Extensions/ServiceCollectionExtensions.cs b/Btms.Consumers/Extensions/ServiceCollectionExtensions.cs index 5078f2e..83545f4 100644 --- a/Btms.Consumers/Extensions/ServiceCollectionExtensions.cs +++ b/Btms.Consumers/Extensions/ServiceCollectionExtensions.cs @@ -1,4 +1,3 @@ -using System.Configuration; using Btms.Common.Extensions; using Btms.Consumers.Interceptors; using Btms.Consumers.MemoryQueue; @@ -7,7 +6,6 @@ using Btms.Types.Ipaffs; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using SlimMessageBus.Host; using SlimMessageBus.Host.Interceptor; using SlimMessageBus.Host.Memory; diff --git a/Btms.Types.Gvms.Mapping.V1/GrmWithTransformMapper.cs b/Btms.Types.Gvms.Mapping.V1/GrmWithTransformMapper.cs index f543d95..6df2a5c 100644 --- a/Btms.Types.Gvms.Mapping.V1/GrmWithTransformMapper.cs +++ b/Btms.Types.Gvms.Mapping.V1/GrmWithTransformMapper.cs @@ -1,6 +1,7 @@ using Btms.Model.Extensions; using Btms.Model.Relationships; +// ReSharper disable once CheckNamespace namespace Btms.Types.Gvms.Mapping; public static class GrmWithTransformMapper diff --git a/Btms.Types.Ipaffs.Mapping.V1/DateTimeMapper.cs b/Btms.Types.Ipaffs.Mapping.V1/DateTimeMapper.cs index a98215d..6ab5b6f 100644 --- a/Btms.Types.Ipaffs.Mapping.V1/DateTimeMapper.cs +++ b/Btms.Types.Ipaffs.Mapping.V1/DateTimeMapper.cs @@ -1,3 +1,4 @@ +// ReSharper disable once CheckNamespace namespace Btms.Types.Ipaffs.Mapping; public static class DateTimeMapper diff --git a/Btms.Types.Ipaffs.Mapping.V1/DictionaryMapper.cs b/Btms.Types.Ipaffs.Mapping.V1/DictionaryMapper.cs index 6275fc8..0eb0ea1 100644 --- a/Btms.Types.Ipaffs.Mapping.V1/DictionaryMapper.cs +++ b/Btms.Types.Ipaffs.Mapping.V1/DictionaryMapper.cs @@ -1,3 +1,4 @@ +// ReSharper disable once CheckNamespace namespace Btms.Types.Ipaffs.Mapping; public static class DictionaryMapper diff --git a/Btms.Types.Ipaffs.Mapping.V1/ImportNotificationWithTransformMapper.cs b/Btms.Types.Ipaffs.Mapping.V1/ImportNotificationWithTransformMapper.cs index 9f5cc08..e92e69b 100644 --- a/Btms.Types.Ipaffs.Mapping.V1/ImportNotificationWithTransformMapper.cs +++ b/Btms.Types.Ipaffs.Mapping.V1/ImportNotificationWithTransformMapper.cs @@ -1,3 +1,4 @@ +// ReSharper disable once CheckNamespace namespace Btms.Types.Ipaffs.Mapping; public static class ImportNotificationWithTransformMapper diff --git a/Btms.Types.Ipaffs.V1/KeyDataPairsToDictionaryStringObjectJsonConverter.cs b/Btms.Types.Ipaffs.V1/KeyDataPairsToDictionaryStringObjectJsonConverter.cs index daf1891..4fc568c 100644 --- a/Btms.Types.Ipaffs.V1/KeyDataPairsToDictionaryStringObjectJsonConverter.cs +++ b/Btms.Types.Ipaffs.V1/KeyDataPairsToDictionaryStringObjectJsonConverter.cs @@ -1,6 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; +// ReSharper disable once CheckNamespace namespace Btms.Types.Ipaffs; public class KeyDataPairsToDictionaryStringObjectJsonConverter : JsonConverter>