public void Setup() { m_ImagesFetcherServiceMock = new Mock <IImagesFetcherService>(); m_WordsHandlerMock = new Mock <IWordsHandler>(); m_ReportGeneratorService = new ReportGeneratorService(m_ImagesFetcherServiceMock.Object, m_WordsHandlerMock.Object); }
public void RunningAReport_OnFilteredData_DoesNotThrow() { // Arrange var report = new TestCompanyProductsInfoReport(1); var settings = new GenericReportSettings <TestExportModel>(true); var exporter = new CsvExporter(); var generator = new ReportGeneratorService(); generator.AddReport(report); // Act Assert.DoesNotThrow(() => { using (var stream = new MemoryStream()) { generator.ExportReport(stream, report.DisplayName, settings, exporter); } }); }
//[Test] public void IntegrationTest() { const string templatePath = @"..\..\Test Templates\Modeled Basic Template.odt"; const string reportPath = @"..\..\Generated Reports\Very Basic Report.odt"; const string expectedReportPath = @"..\..\Expected Report Outputs\Very Basic Report.odt"; var templateFactory = new TemplateFactory(); var zipFactory = new ZipFactory(); var readerFactory = new StreamReaderWrapperFactory(); var zipHandlerService = new ZipHandlerService(readerFactory); var buildOdfMetadataService = new BuildOdfMetadataService(); var xmlNamespaceService = new XmlNamespaceService(); var xDocumentParserService = new XDocumentParserService(); var odfHandlerService = new OdfHandlerService(zipFactory, zipHandlerService, buildOdfMetadataService, xmlNamespaceService, xDocumentParserService); var templateService = new TemplateBuilderService(templateFactory, odfHandlerService, xmlNamespaceService, xDocumentParserService); var document = File.ReadAllBytes(templatePath); var template = templateService.BuildTemplate(document); var razorTemplateService = new TemplateService(); var compileService = new CompileService(razorTemplateService); compileService.Compile(template, "Template 1"); var reportService = new ReportGeneratorService(new ZipFactory(), razorTemplateService); using (var report = new FileStream(reportPath, FileMode.Create)) { reportService.BuildReport(template, new BasicModel { Name = "Fancypants McSnooterson" }, report); } var diffs = GetDifferences(expectedReportPath, reportPath); var thereAreDifferences = diffs.HasDifferences(); Assert.That(!thereAreDifferences); }