Пример #1
0
        private void ProcessFileDaily(string fileName, StockDefinition stockDefinition)
        {
            DataPumpStockData data = new DataPumpStockData();

            _stockDataToDBWriter.StartSession();
            try
            {
                _dataFileIterator.Open(fileName);
                try
                {
                    if (!_dataFileIterator.SetOnLineAfterTS(_dataPumpProvider.GetMaxTS(stockDefinition, StockDataRange.Daily, 0)))
                    {
                        return;
                    }
                    while (!_dataFileIterator.Eof())
                    {
                        string currLine = _dataFileIterator.ReadLine();
                        _lineToStockData.Map(currLine, _dataFileIterator.PreviousLine(), data);
                        _stockDataToDBWriter.WriteDaily(data, stockDefinition);
                    }
                }
                finally
                {
                    _dataFileIterator.Close();
                }
            } finally
            {
                _stockDataToDBWriter.EndSession();
            }
        }
Пример #2
0
 private void TestDailyFor20191104(StockDefinition stock, DateTime initialDateTime, List <string> expectedFirst5Inserts)
 {
     expectedFirst5Inserts.Count.ShouldBe(5);
     _executedQueries.Clear();
     _dataPumpProvider.GetMaxTS(Arg.Compat.Any <StockDefinition>(), StockDataRange.Daily, 0).Returns(initialDateTime);
     TestObj.PumpDaily(stock);
     Console.WriteLine($"{stock.FullName}:");
     Console.WriteLine(string.Join(Environment.NewLine, _executedQueries.ToArray()));
     _executedQueries.Count.ShouldBeGreaterThanOrEqualTo(5);
     for (int i = 0; i < 5; i++)
     {
         _executedQueries[i].ShouldBe(expectedFirst5Inserts[i]);
     }
 }