public void ExportingAnExcelFile_WithData_ShouldWriteSomething() { // Arrange var exportColumns = typeof(TestExportModel).GetPropertyFieldInfos(); var reportSettings = new GenericReportSettings <TestExportModel>(true); var fakes = TestExportModel.GetFakes(); // Act using (var stream = new MemoryStream()) { var exporter = new ExcelExporter(); exporter.WriteData(stream, fakes, reportSettings.Columns); Assert.AreNotEqual(0, stream.Length); } }
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); } }); }
public override IEnumerable GenerateReport(GenericReportSettings <TestExportModel> settings) { var data = TestExportModel.GetFakes().Where(entry => entry.CompanyId == CompanyId); return(settings.Filter(data)); }