示例#1
0
        public void WriteReportCsvFile()
        {
            // create url report
            var urlReport = new UrlReport(
                new[]
            {
                new UrlReportRecord
                {
                    Url = "/url"
                }
            });

            // write url report
            var reportCsvFile = Path.Combine(
                TestData.TestData.CurrentDirectory,
                @"report.csv");

            using (var reportCsvWriter = new ReportCsvWriter <UrlReportRecord>(reportCsvFile))
            {
                reportCsvWriter.Write(urlReport);
            }

            // read url report lines
            var urlReportLines =
                File.ReadAllLines(reportCsvFile);

            // verify url report lines
            Assert.AreEqual(2, urlReportLines.Length);
            Assert.AreEqual(
                "\"Url\"",
                urlReportLines[0]);
            Assert.AreEqual(
                "\"/url\"",
                urlReportLines[1]);
        }
示例#2
0
 public virtual void WriteReportCsvFile(
     string path)
 {
     using (var reportCsvWriter = new ReportCsvWriter <T>(
                path))
     {
         reportCsvWriter.Write(this);
     }
 }