public void Setup() { _actualProcessedZips = Sets.NewHashSet <string>(); _actualGroupedIds = null; _actualGroups = Lists.NewList <IKaVESet <string> >(); _actualCleanedZips = Lists.NewList <string>(); _io = Mock.Of <IPreprocessingIo>(); Mock.Get(_io).Setup(io => io.FindRelativeZipPaths()).Returns(GetExpectedZips()); Mock.Get(_io) .Setup(io => io.GetFullPath_In(It.IsAny <string>())) .Returns <string>(relZip => "<dirIn>\\" + relZip); Mock.Get(_io) .Setup(io => io.GetFullPath_Merged(It.IsAny <string>())) .Returns <string>(relZip => "<dirMerged>\\" + relZip); Mock.Get(_io) .Setup(io => io.GetFullPath_Out(It.IsAny <string>())) .Returns <string>(relZip => "<dirOut>\\" + relZip); _log = Mock.Of <IMultiThreadedPreprocessingLogger>(); Mock.Get(_log) .Setup(l => l.Error(It.IsAny <int>(), It.IsAny <Exception>())) .Callback <int, Exception>((taskId, ex) => _lastLoggedException = ex); _sut = new MultiThreadedPreprocessing( _io, _log, NumWorker, IdReaderFactory, CreateGrouper(), GroupMergerFactory, CleanerFactory); }
public void ErrorsInZipCleaningAreReportedAndExcecutionContinues() { var ex = CaptureException(); _sut = new MultiThreadedPreprocessing( _io, _log, NumWorker, IdReaderFactory, CreateGrouper(), GroupMergerFactory, taskId => new CrashingCleaner(ex)); _sut.Run(); Assert.AreSame(ex, _lastLoggedException); }