public void TestMethod1()
        {
            string fileName = $"{GetCurrentMethod()}.csv";

            CsvData data = new CsvData(new[] { "head1", "head2" });

            data.AddRow(new[] { ",", "comma" });
            data.AddRow(new[] { "\"", "quote" });
            data.AddRow(new[] { "\r", "r" });
            data.AddRow(new[] { "\n", "n" });

            var csvWriter = new CsvWriter();

            csvWriter.Write(fileName, data);

            using (TextReader tr = new StreamReader(fileName))
            {
                string str    = tr.ReadToEnd();
                string result =
                    "head1,head2" + Environment.NewLine +
                    "\",\",comma" + Environment.NewLine +
                    "\"\"\"\",quote" + Environment.NewLine +
                    "\"\r\",r" + Environment.NewLine +
                    "\"\n\",n" + Environment.NewLine;

                Assert.AreEqual(str, result);
            }
        }
        public CsvData CreateCsvData(AggregatedData data)
        {
            CsvData report = new CsvData(new[] { "Local Time", "Volume" });

            DateTime utcSessionStart = data.TradingDate.AddDays(-1).Add(data.SessionStart);

            for (int i = 0; i < data.Volumes.Length; i++)
            {
                DateTime localTime = utcSessionStart.Add(TimeSpan.FromHours(i)).ToLocalTime();

                string time   = localTime.TimeOfDay.ToString(@"hh\:mm");
                string volume = data.Volumes[i].ToString(CultureInfo.InvariantCulture);

                report.AddRow(new[] { time, volume });
            }
            return(report);
        }