Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Uris" Version="9.0.0" />
<PackageVersion Include="ClientProxyBase" Version="2026.10.4" />
<PackageVersion Include="HealthMonitoring.Client" Version="2026.10.1" />
<PackageVersion Include="ClientProxyBase" Version="2026.11.2" />
<PackageVersion Include="HealthMonitoring.Client" Version="2026.10.2.55" />
<PackageVersion Include="OpenIddict.Validation.AspNetCore" Version="7.7.2" />
<PackageVersion Include="OpenIddict.Validation.SystemNetHttp" Version="7.7.2" />
<PackageVersion Include="coverlet.collector" Version="10.1.0" />
<PackageVersion Include="coverlet.msbuild" Version="10.1.0" />
<PackageVersion Include="Ductus.FluentDocker" Version="2.85.0" />
<PackageVersion Include="EventStoreProjections" Version="2023.12.3" />
<PackageVersion Include="Grpc.Net.Client" Version="2.84.0" />
<PackageVersion Include="Imposter" Version="1.0.3" />
<PackageVersion Include="Imposter" Version="1.0.7" />
<PackageVersion Include="Lamar" Version="16.0.0" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="16.0.0" />
<PackageVersion Include="MessagingService.IntegrationTesting.Helpers" Version="2026.10.2.156" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.13" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.13" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.13" />
<PackageVersion Include="MessagingService.IntegrationTesting.Helpers" Version="2026.10.3.157" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.14" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.14" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.14" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.14" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.14" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.14" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.14" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.11.0" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
Expand All @@ -39,17 +39,17 @@
<PackageVersion Include="Sentry.AspNetCore" Version="6.12.1" />
<PackageVersion Include="SharpCompress" Version="0.50.7" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="Shared" Version="2026.10.4" />
<PackageVersion Include="Shared.DomainDrivenDesign" Version="2026.10.4" />
<PackageVersion Include="Shared.EventStore" Version="2026.10.4" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.10.4" />
<PackageVersion Include="Shared.Results" Version="2026.10.4" />
<PackageVersion Include="Shared.Results.Web" Version="2026.10.4" />
<PackageVersion Include="SecurityService.Client" Version="2026.10.2.200" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.10.2.200" />
<PackageVersion Include="Shared" Version="2026.11.2" />
<PackageVersion Include="Shared.DomainDrivenDesign" Version="2026.11.2" />
<PackageVersion Include="Shared.EventStore" Version="2026.11.2" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.11.2" />
<PackageVersion Include="Shared.Results" Version="2026.11.2" />
<PackageVersion Include="Shared.Results.Web" Version="2026.11.2" />
<PackageVersion Include="SecurityService.Client" Version="2026.10.3.204" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.10.3.204" />
<PackageVersion Include="System.IO.Abstractions" Version="22.3.0" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.3.0" />
<PackageVersion Include="TransactionProcessing.ApiDefaults" Version="2026.10.4" />
<PackageVersion Include="TransactionProcessing.ApiDefaults" Version="2026.11.2" />
<PackageVersion Include="TransactionProcessor.Client" Version="2026.10.2.411" />
<PackageVersion Include="TransactionProcessor.Database" Version="2026.10.2.411" />
<PackageVersion Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2026.10.2.411" />
Expand Down
46 changes: 26 additions & 20 deletions FileProcessor.BusinessLogic.Tests/CapturingLogger.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using System.Linq;
using Shared.Logger;

namespace FileProcessor.BusinessLogic.Tests;

internal sealed class CapturingLogger<T> : ILogger<T>
internal sealed class CapturingLogger : Shared.Logger.ILogger
{
public List<string> Messages { get; } = new();

public IDisposable BeginScope<TState>(TState state) where TState : notnull => NullScope.Instance;
public bool IsInitialised { get; set; } = true;

public bool IsEnabled(LogLevel logLevel) => true;
public List<string> Messages { get; } = new();

public void Log<TState>(LogLevel logLevel,
EventId eventId,
TState state,
Exception exception,
Func<TState, Exception, string> formatter)
{
this.Messages.Add(formatter(state, exception));
}
public void LogCritical(string message) => this.Capture(message);
public void LogCritical(Exception exception) => this.Capture(exception.ToString());
public void LogCritical(string message, params object[] args) => this.Capture(message, args);
public void LogCritical(Exception exception, string message, params object[] args) => this.Capture(message, args, exception.ToString());
public void LogCritical(string message, Exception exception) => this.Capture(message, null, exception.ToString());
public void LogDebug(string message) => this.Capture(message);
public void LogDebug(string message, params object[] args) => this.Capture(message, args);
public void LogError(Exception exception) => this.Capture(exception.ToString());
public void LogError(string message, params object[] args) => this.Capture(message, args);
public void LogError(Exception exception, string message, params object[] args) => this.Capture(message, args, exception.ToString());
public void LogError(string message) => this.Capture(message);
public void LogError(string message, Exception exception) => this.Capture(message, null, exception.ToString());
public void LogInformation(string message) => this.Capture(message);
public void LogInformation(string message, params object[] args) => this.Capture(message, args);
public void LogTrace(string message) => this.Capture(message);
public void LogTrace(string message, params object[] args) => this.Capture(message, args);
public void LogWarning(string message) => this.Capture(message);
public void LogWarning(string message, params object[] args) => this.Capture(message, args);

private sealed class NullScope : IDisposable
private void Capture(string message, object[] args = null, string exception = null)
{
public static NullScope Instance { get; } = new();

public void Dispose()
{
}
String renderedArguments = args is { Length: > 0 } ? String.Join(" ", args) : String.Empty;
this.Messages.Add(String.Join(" ", new[] { message, renderedArguments, exception }.Where(value => !String.IsNullOrEmpty(value))));
}
}
3 changes: 2 additions & 1 deletion FileProcessor.BusinessLogic.Tests/DomainEventHandlerTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Shared.Logger;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -23,7 +24,7 @@ public class DomainEventHandlerTests
{
public DomainEventHandlerTests()
{
Shared.Logger.Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());
}

[Fact]
Expand Down
6 changes: 2 additions & 4 deletions FileProcessor.BusinessLogic.Tests/DomainServiceHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using FileProcessor.BusinessLogic.Services;
using Microsoft.Extensions.Logging.Abstractions;

using Shared.EventStore.Helpers;
using Shared.Logger;
using Shouldly;
using SimpleResults;
using Xunit;
Expand All @@ -12,7 +10,7 @@ namespace FileProcessor.BusinessLogic.Tests;
public class DomainServiceHelperTests
{
public DomainServiceHelperTests() {
Shared.Logger.Logger.Initialise(NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public class FileProcessorDomainServiceTests
private FileProcessorDomainService FileProcessorDomainService;

private MockFileSystem FileSystem;
private CapturingLogger<FileProcessorDomainService> DiagnosticLogger;
private CapturingLogger DiagnosticLogger;
public FileProcessorDomainServiceTests()
{
IConfigurationRoot configurationRoot = new ConfigurationBuilder().AddInMemoryCollection(TestData.DefaultAppSettings).Build();
ConfigurationReader.Initialise(configurationRoot);

Logger.Initialise(NullLogger.Instance);
//Logger.Initialise(NullLogger.Instance);

this.FileProcessorManager = new IFileProcessorManagerImposter();
this.FileProcessorManager.GetFileProfileVersion(Arg<Guid>.Any(),
Expand All @@ -73,7 +73,7 @@ public FileProcessorDomainServiceTests()
this.FileFormatHandler.ValidateFile(Arg<TextReader>.Any(), Arg<String>.Any()).Returns(
new FileValidationResult(Guid.Empty, true, Array.Empty<FileValidationError>()));
this.FileSystem = new MockFileSystem();
this.DiagnosticLogger = new CapturingLogger<FileProcessorDomainService>();
this.DiagnosticLogger = new CapturingLogger();

Func<String, IFileFormatHandler> fileFormatHandlerResolver = (format) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
using FileProcessor.BusinessLogic.Services;
using FileProcessor.Models;
using MediatR;
using Microsoft.Extensions.Logging.Abstractions;
using Imposter.Abstractions;
using Shared.Results;
using Shouldly;
using SimpleResults;
using FileProcessor.Testing;
using Shared.Logger;
using FileProfileModel = global::FileProcessor.Models.FileProfile;
using FileImportLogModel = global::FileProcessor.Models.FileImportLog;
using Xunit;
Expand All @@ -26,7 +26,7 @@ public class FileProfileDirectoryRecoveryServiceTests
[Fact]
public async Task RecoverInProgressFilesAsync_ReplaysFilesFoundInInProgressDirectory()
{
Shared.Logger.Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());

IFileProcessorManagerImposter fileProcessorManager = new();
IMediatorImposter mediator = new();
Expand Down Expand Up @@ -72,7 +72,7 @@ public async Task RecoverInProgressFilesAsync_ReplaysFilesFoundInInProgressDirec
[Fact]
public async Task RecoverInProgressFilesAsync_WhenFileAggregateIsMissing_ReplaysUsingImportLogDetails()
{
Shared.Logger.Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());

IFileProcessorManagerImposter fileProcessorManager = new();
IMediatorImposter mediator = new();
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task RecoverInProgressFilesAsync_WhenFileAggregateIsMissing_Replays
[Fact]
public async Task RecoverInProgressFilesAsync_ReplaysFilesFromHistoricalAndCurrentDirectories()
{
Shared.Logger.Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());

IFileProcessorManagerImposter fileProcessorManager = new();
IMediatorImposter mediator = new();
Expand Down Expand Up @@ -198,7 +198,7 @@ public async Task RecoverInProgressFilesAsync_ReplaysFilesFromHistoricalAndCurre
[Fact]
public async Task RecoverInProgressFilesAsync_WhenVersionsShareDirectory_ReplaysFileOnce()
{
Shared.Logger.Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance);
Shared.Logger.Logger.Initialise(new NullLogger());

IFileProcessorManagerImposter fileProcessorManager = new();
IMediatorImposter mediator = new();
Expand Down
Loading
Loading