| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using NUnit.Framework;
- using QuestPDF.Drawing;
- using QuestPDF.Fluent;
- using QuestPDF.Infrastructure;
- using QuestPDF.ReportSample.Layouts;
- namespace QuestPDF.ReportSample
- {
- public class ReportGeneration
- {
- private StandardReport Report { get; set; }
-
- [SetUp]
- public void SetUp()
- {
- var model = DataSource.GetReport();
- Report = new StandardReport(model);
- }
-
- [Test]
- public void GenerateAndShowPdf()
- {
- //ImagePlaceholder.Solid = true;
-
- var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.pdf");
- Report.GeneratePdf(path);
- Process.Start("explorer.exe", path);
- }
-
- [Test]
- public void GenerateAndShowXps()
- {
- var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.xps");
- Report.GenerateXps(path);
- Process.Start("explorer.exe", path);
- }
-
- [Test]
- public void Profile()
- {
- ImagePlaceholder.Solid = true;
-
- var container = new DocumentContainer();
- Report.Compose(container);
- var content = container.Compose();
-
- var pageContext = new PageContext();
- DocumentGenerator.RenderPass(pageContext, new FreeCanvas(), content, null);
- DocumentGenerator.RenderPass(pageContext, new FreeCanvas(), content, null);
- }
- }
- }
|