Refactor DTOs and tests; add framework-specific handling

Refactored the codebase to use shared DTOs from `DocumentService.Application.Common.DTOs`, removing inline DTO definitions in client interfaces and tests. Introduced conditional compilation to handle framework-specific differences in DTOs and handlers.

Updated test cases to align with the new DTO structures, including `SwissQrCodeExtractionResult`, `PdfValidationResult`, and `ZugferdExtractionResult`. Adjusted test data to match updated DTO properties.

Cleaned up solution and project files, ensuring proper references and organization. Removed unused files and fixed project references in `DocumentService.Tests.csproj`. Improved maintainability and consistency across the codebase.
This commit is contained in:
2026-08-31 00:54:38 +02:00
parent 108e522316
commit 75bea9ef29
18 changed files with 65 additions and 133 deletions

View File

@@ -32,6 +32,10 @@ namespace DocumentService.Application.Common.DTOs;
/// }
/// </example>
public record SwissQrCodeExtractionResult(
#if NET
SwissQrBillDto Bill,
IReadOnlyList<string> RawLines
);
#else
object? Bill,
#endif
IEnumerable<string> RawLines
);

View File

@@ -52,10 +52,8 @@
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<Compile Remove="Common\Interfaces\ISwissQrCodeProcessor.cs" />
<Compile Remove="Common\DTOs\SwissQrBillDto.cs" />
<Compile Remove="Common\DTOs\SwissQrCodeExtractionResult.cs" />
<Compile Remove="Common\Mapping\MappingProfile.cs" />
<Compile Remove="SwissQrCode\**" />
<Compile Remove="ExtractZugferd\**" />
<Compile Remove="HasZugferd\**" />
<Compile Remove="DependencyInjection.cs" />
</ItemGroup>

View File

@@ -18,6 +18,7 @@ public record ExtractZugferdCommand : IRequest<ZugferdExtractionResult>
public required Stream PdfStream { get; init; }
}
#if NET
/// <summary>
/// Handler for ExtractZugferdCommand.
/// Extracts ZUGFeRD XML from PDF and returns XML content
@@ -77,6 +78,7 @@ public class ExtractZugferdCommandHandler(
};
}
}
#endif
/// <summary>
/// Validator for ExtractZugferdCommand.