public void TestWatcherFileFindEventAddItemIntoObservableCollection()
 {
     //given
     var watcher = new Mock<IFolderWatcher>();
     var file = new StockFile();
     var vm = new MainViewModel(watcher.Object);
     //when
     watcher.Raise(w => w.FileFound += null, new FileFoundEventHandlerArgs {File = file});
     //then
     Assert.That(vm.Files.Count, Is.EqualTo(1));
     Assert.That(vm.Files[0], Is.SameAs(file));
 }
 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));
 }
 public async void TestReadFile()
 {
     //given
     const string filePath = "c:\\d\\d\\test.xml";
     var xmlFile = new XmlStockFile();
     var stockFile = new StockFile();
     var fileHelper = Mock.Of<IXmlStockFileReaderHelper>(h => h.ReadXmlFile(filePath) == xmlFile);
     var mapper = Mock.Of<IXmlStockFileMapper>(m => m.Map("test", xmlFile) == stockFile);
     
     var reader = new XmlStockFileReader(mapper, fileHelper);
     //when
     var result = await reader.ReadFile(filePath);
     //then
     Assert.That(result, Is.SameAs(stockFile));
 }