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

@@ -1,3 +1,6 @@
using DocumentService.Application.Common.DTOs;
using DocumentService.Application.ExtractZugferd;
namespace DocumentService.Client.Interfaces;
/// <summary>
@@ -53,27 +56,3 @@ public interface IZugferdClient
/// <returns>Structured ZUGFeRD extraction result</returns>
Task<ZugferdExtractionResult> ExtractZugferdAsResultAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
}
/// <summary>DTO for ZUGFeRD detection result</summary>
public record ZugferdCheckResult
{
/// <summary>Whether the document contains a ZUGFeRD XML attachment.</summary>
public bool HasZugferd { get; init; }
/// <summary>Detected ZUGFeRD version (e.g. "2.1"), or <c>null</c> if not present.</summary>
public string? Version { get; init; }
/// <summary>ZUGFeRD profile name (e.g. "EN 16931"), or <c>null</c> if not present.</summary>
public string? Profile { get; init; }
}
/// <summary>DTO for ZUGFeRD extraction result</summary>
public record ZugferdExtractionResult
{
/// <summary>File name of the extracted XML attachment (e.g. "factur-x.xml").</summary>
public string FileName { get; init; } = string.Empty;
/// <summary>Full XML content of the ZUGFeRD attachment.</summary>
public string XmlContent { get; init; } = string.Empty;
/// <summary>ZUGFeRD version (e.g. "2.1"), or <c>null</c> if not detected.</summary>
public string? Version { get; init; }
/// <summary>ZUGFeRD profile name (e.g. "EN 16931"), or <c>null</c> if not detected.</summary>
public string? Profile { get; init; }
}