public void Init()
        {
            _log = Substitute.For<ILog>();
            _dateCalculator = Substitute.For<IDateCalculator>();
            _powerService = Substitute.For<IPowerService>();
            _positionAggregator = Substitute.For<IPositionAggregator>();
            _fileNameGenerator = Substitute.For<IFileNameGenerator>();
            _reportContentWriter = Substitute.For<IReportContentWriter>();
            _file = Substitute.For<IFile>();
            _reportGenerator = new ReportGenerator(_log, _dateCalculator, _powerService, _positionAggregator, _fileNameGenerator, _reportContentWriter, _file);

            _reportFolder = @"C:\Temp\";
            _dates = new DateResult { ExtractDateTime = new DateTime(2015, 10, 5, 23, 34, 0), RequestDate = new DateTime(2015, 10, 6) };

            _powerTradeOne = new PowerTrade();
            _powerTradeTwo = new PowerTrade();
            _powerTrades = new[] { _powerTradeOne, _powerTradeTwo };
            _powerPosition = new PowerPosition();
            _fileName = "PowerPositions.csv";
            _content = "Local time, Volume etc";

            _dateCalculator.Calculate().Returns(_dates);
            _powerService.GetTrades(_dates.RequestDate).Returns(_powerTrades);
            _positionAggregator.Aggregate(_dates.RequestDate, Arg.Is<List<PowerTrade>>(x => x[0] == _powerTradeOne && x[1] == _powerTradeTwo)).Returns(_powerPosition);
            _fileNameGenerator.Generate(_dates.ExtractDateTime).Returns(_fileName);
            _reportContentWriter.Write(_powerPosition).Returns(_content);
        }
        public void Init()
        {
            _log                 = Substitute.For <ILog>();
            _dateCalculator      = Substitute.For <IDateCalculator>();
            _powerService        = Substitute.For <IPowerService>();
            _positionAggregator  = Substitute.For <IPositionAggregator>();
            _fileNameGenerator   = Substitute.For <IFileNameGenerator>();
            _reportContentWriter = Substitute.For <IReportContentWriter>();
            _file                = Substitute.For <IFile>();
            _reportGenerator     = new ReportGenerator(_log, _dateCalculator, _powerService, _positionAggregator, _fileNameGenerator, _reportContentWriter, _file);

            _reportFolder = @"C:\Temp\";
            _dates        = new DateResult {
                ExtractDateTime = new DateTime(2015, 10, 5, 23, 34, 0), RequestDate = new DateTime(2015, 10, 6)
            };

            _powerTradeOne = new PowerTrade();
            _powerTradeTwo = new PowerTrade();
            _powerTrades   = new[] { _powerTradeOne, _powerTradeTwo };
            _powerPosition = new PowerPosition(_dates.RequestDate);
            _fileName      = "PowerPositions.csv";
            _content       = "Local time, Volume etc";

            _dateCalculator.Calculate().Returns(_dates);
            _powerService.GetTrades(_dates.RequestDate).Returns(_powerTrades);
            _positionAggregator.Aggregate(_dates.RequestDate, Arg.Is <List <PowerTrade> >(x => x[0] == _powerTradeOne && x[1] == _powerTradeTwo)).Returns(_powerPosition);
            _fileNameGenerator.Generate(_dates.ExtractDateTime).Returns(_fileName);
            _reportContentWriter.Write(_powerPosition).Returns(_content);
        }
 public ReportGenerator(ILog log, IDateCalculator dateCalculator, IPowerService powerService, IPositionAggregator positionAggregator, IFileNameGenerator fileNameGenerator, IReportContentWriter reportContentWriter, IFile file)
 {
     _log = log;
     _dateCalculator = dateCalculator;
     _powerService = powerService;
     _positionAggregator = positionAggregator;
     _fileNameGenerator = fileNameGenerator;
     _reportContentWriter = reportContentWriter;
     _file = file;
 }
Esempio n. 4
0
 public ReportGenerator(ILog log, IDateCalculator dateCalculator, IPowerService powerService, IPositionAggregator positionAggregator, IFileNameGenerator fileNameGenerator, IReportContentWriter reportContentWriter, IFile file)
 {
     _log                 = log;
     _dateCalculator      = dateCalculator;
     _powerService        = powerService;
     _positionAggregator  = positionAggregator;
     _fileNameGenerator   = fileNameGenerator;
     _reportContentWriter = reportContentWriter;
     _file                = file;
 }
Esempio n. 5
0
 public void Init()
 {
     _writer = new ReportContentWriter();
 }
 public void Init()
 {
     _writer = new ReportContentWriter();
 }