Tests.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using System.Linq;
  5. using NUnit.Framework;
  6. using QuestPDF.Drawing;
  7. using QuestPDF.Fluent;
  8. using QuestPDF.Infrastructure;
  9. using QuestPDF.ReportSample.Layouts;
  10. namespace QuestPDF.ReportSample
  11. {
  12. public class ReportGeneration
  13. {
  14. private StandardReport Report { get; set; }
  15. [SetUp]
  16. public void SetUp()
  17. {
  18. var model = DataSource.GetReport();
  19. Report = new StandardReport(model);
  20. }
  21. [Test]
  22. public void GenerateAndShowPdf()
  23. {
  24. //ImagePlaceholder.Solid = true;
  25. var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.pdf");
  26. Report.GeneratePdf(path);
  27. Process.Start("explorer.exe", path);
  28. }
  29. [Test]
  30. public void GenerateAndShowXps()
  31. {
  32. var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.xps");
  33. Report.GenerateXps(path);
  34. Process.Start("explorer.exe", path);
  35. }
  36. }
  37. }