public void Generate_Only_Headers_Without_Trades()
        {
            var sut = new PositionReportGenerator();

            var position = CalculatedPositionInfoLocalDate.Create(DateTime.UtcNow, Enumerable.Empty <Trade>());

            var report = sut.Generate(position);

            var truncatedReport = report.Replace(Environment.NewLine, string.Empty);

            truncatedReport.Should().Be("Local Time,Volume", "Strict report check. Headers must match.");
        }
        public static IPositionReporter Create(string location)
        {
            if (string.IsNullOrWhiteSpace(location))
            {
                throw new Exception("Invalid empty location for reporter.");
            }

            var generator = new PositionReportGenerator();
            var saver     = new PositionReportSaver(location);

            return(new PositionReporter(generator, saver));
        }
        public void Generate_Rows()
        {
            var sut = new PositionReportGenerator();

            var position = CalculatedPositionInfoLocalDate.Create(
                date: DateTime.Parse("01/04/2015"),
                trades: new[]
            {
                Trade.Create(19, -42)
            });

            var report = sut.Generate(position);

            var indexHeaderEnd = report.IndexOf(Environment.NewLine, StringComparison.Ordinal);

            var truncatedReport = report
                                  .Substring(indexHeaderEnd)
                                  .Replace(Environment.NewLine, string.Empty);

            truncatedReport.Should().Be("17:00,-42", "Strict report check. Rows must match.");
        }