diff --git a/DocumentService.Tests.NuGet/DocumentService.Tests.NuGet.csproj b/DocumentService.Tests.NuGet/DocumentService.Tests.NuGet.csproj new file mode 100644 index 0000000..fc55aea --- /dev/null +++ b/DocumentService.Tests.NuGet/DocumentService.Tests.NuGet.csproj @@ -0,0 +1,18 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + diff --git a/DocumentService.Tests.NuGet/Program.cs b/DocumentService.Tests.NuGet/Program.cs new file mode 100644 index 0000000..7cf0da7 --- /dev/null +++ b/DocumentService.Tests.NuGet/Program.cs @@ -0,0 +1,36 @@ +using DocumentService.Client; + +// 1. Configure the client +Client.Configure("http://172.24.12.39:9393/"); + +// 2. Load embedded PDF resource +var assembly = typeof(Program).Assembly; +var resourceName = assembly.GetManifestResourceNames() + .FirstOrDefault(n => n.EndsWith("valid.pdf", StringComparison.OrdinalIgnoreCase)); + +if (resourceName is null) +{ + Console.WriteLine("❌ Embedded resource 'valid.pdf' not found."); + return; +} + +try +{ + using var stream = assembly.GetManifestResourceStream(resourceName)!; + var result = await Client.Validation.ValidateAsync(stream); + + Console.WriteLine("✅ Connection successful!"); + Console.WriteLine($" Page count : {result.PageCount}"); + Console.WriteLine($" PDF version : {result.PdfVersion}"); + Console.WriteLine($" Encrypted : {result.IsEncrypted}"); + Console.WriteLine($" Attachments : {result.AttachmentCount}"); + Console.WriteLine($" File size : {result.FileSizeMB:F2} MB"); +} +catch (HttpRequestException ex) +{ + Console.WriteLine("❌ HTTP error: " + ex.Message); +} +catch (InvalidOperationException ex) +{ + Console.WriteLine("❌ Client error: " + ex.Message); +} \ No newline at end of file diff --git a/DocumentService.Tests.NuGet/valid.pdf b/DocumentService.Tests.NuGet/valid.pdf new file mode 100644 index 0000000..e8974ea Binary files /dev/null and b/DocumentService.Tests.NuGet/valid.pdf differ