Beispiel #1
0
        private static CsvReportBuilder GetCsvReportBuilder(List <SaleData> salesData)
        {
            var dataBuilder = new CsvConfigurationBuilder <SaleData>()
                              .ForMember(m => m.date, opts => opts.Formatter(o => ((DateTime)o).ToShortDateString()));

            var reportBuilder = new CsvReportBuilder();

            _ = reportBuilder.DataContent(salesData, dataBuilder.BuildConfiguration());
            return(reportBuilder);
        }
Beispiel #2
0
        public void WriteComment()
        {
            var reportBuilder = new CsvReportBuilder()
                                .Comments("Test Line 1", "Test Line 2");

            var csvData = reportBuilder.GetAsString();
            var sb      = new StringBuilder();

            _ = sb.AppendLine("#Test Line 1");
            _ = sb.AppendLine("#Test Line 2");

            Assert.Equal(sb.ToString(), csvData);
        }