public void TestMatchShouldNotMatchOnBadString() { //given const string filePath = "asdasdasda.csv.asdasdasd"; var mapper = Mock.Of <ITextStockFileMapper>(); var fileHelper = Mock.Of <IFileReaderHelper>(); var reader = new TextStockFileReader(mapper, fileHelper); //when var result = reader.Match(filePath); //then Assert.That(result, Is.False); }
public void TestMatch() { //given const string filePath = "c:\\d\\d\\test.txt"; var mapper = Mock.Of <ITextStockFileMapper>(); var fileHelper = Mock.Of <IFileReaderHelper>(); var reader = new TextStockFileReader(mapper, fileHelper); //when var result = reader.Match(filePath); //then Assert.That(result, Is.True); }
public async void TestReadFile() { //given const string filePath = "c:\\d\\d\\test.txt"; var fileLines = new[] { "" }; var stockFile = new StockFile(); var fileHelper = Mock.Of <IFileReaderHelper>(h => h.ReadText(filePath) == fileLines); var mapper = Mock.Of <ITextStockFileMapper>(m => m.Map("test", fileLines) == stockFile); var reader = new TextStockFileReader(mapper, fileHelper); //when var result = await reader.ReadFile(filePath); //then Assert.That(result, Is.SameAs(stockFile)); }