private void HandleFiles(IList <string> droppedFiles) { var directConversionFiles = new List <string>(); var printFiles = new List <string>(); foreach (var file in droppedFiles) { if (_directConversion.CanConvertDirectly(file)) { directConversionFiles.Add(file); } else { printFiles.Add(file); } } foreach (var directConversionFile in directConversionFiles) { _directConversion.ConvertDirectly(directConversionFile); } if (printFiles.Any()) { PrintPrintableFiles(printFiles); } }
public void HandleDroppedFiles_ListWithExistingAndNonExistingPrintableFiles_ExistingFilesGetPrinted() { _fileWrap.Exists(_droppedFiles[0]).Returns(true); _fileWrap.Exists(_droppedFiles[1]).Returns(false); _fileWrap.Exists(_droppedFiles[2]).Returns(true); _directConversion.CanConvertDirectly("").ReturnsForAnyArgs(false); _printFileHelper.AddFiles(null).ReturnsForAnyArgs(true); _fileConversionHandler.HandleFileList(_droppedFiles); Assert.AreEqual(2, _directConversion.ReceivedCalls().Count()); _printFileHelper.Received(1).AddFiles(Arg.Is <List <string> >(x => (x.Count == 2) && x[0].Equals(_droppedFiles[0]) && x[1].Equals(_droppedFiles[2]))); _printFileHelper.Received(1).PrintAll(); }