protected override void Arrange() { base.Arrange(); var reader = MockRepository.GenerateStub<IFileReader>(); expectedEntity = new InputDataEntity { Date = DateTime.Now, Open = 1.1f, High = 2.2f, Low = 3.3f, Close = 4.4f, Volume = 1000 }; reader.Stub(m => m.GetEntities(Arg<string>.Is.Anything)).Return(new List<InputDataEntity> { expectedEntity }); this.fileProcessor = new FileProcessor(reader, "DummyFileName"); }
public IEnumerable<InputDataEntity> GetEntities(string filePath) { var reader = new StreamReader(File.OpenRead(filePath)); while (!reader.EndOfStream) { var line = reader.ReadLine(); if (line == null) continue; var rowValues = line.Split(','); var entity = new InputDataEntity { Date = DateTime.Parse(rowValues[0]), Open = float.Parse(rowValues[1].Replace('.', ',')), High = float.Parse(rowValues[2].Replace('.', ',')), Low = float.Parse(rowValues[3].Replace('.', ',')), Close = float.Parse(rowValues[4].Replace('.', ',')), Volume = int.Parse(rowValues[5]) }; yield return entity; } }