test(live): add live API integration test project (DocumentService.Tests.Live)
End-to-end tests that run against a real, deployed API instance to verify that
all controllers respond correctly over HTTP - bypassing WebApplicationFactory.
Project setup:
- Targets net8.0; xUnit 2.9.3 + FluentAssertions 7.0.0
- References DocumentService.Client, Application and Domain as project refs
- Embeds 4 test PDFs as EmbeddedResources:
valid.pdf, pdfWithSwissQRCode.pdf, pdfWithMoreThanOneAttachment.pdf,
encryptedPdf.pdf
LiveApiTestBase:
- Base URL defaults to http://172.24.12.39:9393, overridable via
LIVE_API_BASE_URL env var
- Constructs typed clients (PdfValidationClient, PdfAttachmentClient,
PdfOperationsClient, SwissQrCodeClient) backed by a single HttpClient
- LoadPdfBytes / LoadPdfStream helpers for EmbeddedResource access
Test coverage per file:
- PdfValidationLiveTests : Stream + byte[] overloads for validate and
validate-pdfa; empty/corrupted inputs assert 4xx/5xx
- PdfAttachmentLiveTests : check + extract endpoints; stream and byte[] variants
- PdfOperationsLiveTests : merge and stamp endpoints
- SwissQrCodeLiveTests : extract Swiss QR bill; invalid content asserts error
Tests are intentionally skipped in CI (no live server); run manually with
the LIVE_API_BASE_URL variable pointing to a running instance.
This commit is contained in:
30
DocumentService.Tests.Live/TestData/Pdfs/encryptedPdf.pdf
Normal file
30
DocumentService.Tests.Live/TestData/Pdfs/encryptedPdf.pdf
Normal file
@@ -0,0 +1,30 @@
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<< /Type /Catalog /Pages 2 0 R >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >>
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Filter /Standard /V 2 /R 3 /Length 128 /P -3904 /O (OwnerHash12345678901234567890123456) /U (UserHash12345678901234567890123456) >>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 5
|
||||
0000000000 65535 f
|
||||
0000000009 00000 n
|
||||
0000000058 00000 n
|
||||
0000000115 00000 n
|
||||
0000000206 00000 n
|
||||
|
||||
trailer
|
||||
<< /Size 5 /Root 1 0 R /Encrypt 4 0 R >>
|
||||
startxref
|
||||
370
|
||||
%%EOF
|
||||
Binary file not shown.
BIN
DocumentService.Tests.Live/TestData/Pdfs/pdfWithSwissQRCode.pdf
Normal file
BIN
DocumentService.Tests.Live/TestData/Pdfs/pdfWithSwissQRCode.pdf
Normal file
Binary file not shown.
BIN
DocumentService.Tests.Live/TestData/Pdfs/valid.pdf
Normal file
BIN
DocumentService.Tests.Live/TestData/Pdfs/valid.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user