public void HandleRenameEventOfNonExistingPath() { var handler = new RenamedFileSystemEventHandler(this.queue.Object, this.fsFactory.Object); string newPath = Path.Combine(RootPath, this.newName); this.fsFactory.Setup(f => f.IsDirectory(newPath)).Returns((bool?)null); handler.Handle(null, this.CreateEvent(this.oldName, this.newName)); this.queue.VerifyThatNoOtherEventIsAddedThan <StartNextSyncEvent>(); this.queue.Verify(q => q.AddEvent(It.Is <StartNextSyncEvent>(e => e.FullSyncRequested == true)), Times.Once); }
public void HandleExceptionsByInvokingCrawlSync() { var handler = new RenamedFileSystemEventHandler(this.queue.Object, this.fsFactory.Object); string newPath = Path.Combine(RootPath, this.newName); this.fsFactory.Setup(f => f.IsDirectory(newPath)).Throws(new Exception("IOException")); handler.Handle(null, this.CreateEvent(this.oldName, this.newName)); this.queue.VerifyThatNoOtherEventIsAddedThan <StartNextSyncEvent>(); this.queue.Verify(q => q.AddEvent(It.Is <StartNextSyncEvent>(e => e.FullSyncRequested == true)), Times.Once); }
public void HandleRenameFileEvent() { var handler = new RenamedFileSystemEventHandler(this.queue.Object, this.fsFactory.Object); string newPath = Path.Combine(rootPath, newName); string oldPath = Path.Combine(rootPath, oldName); this.fsFactory.Setup(f => f.IsDirectory(newPath)).Returns((bool?)false); handler.Handle(null, this.CreateEvent(oldName, newName)); this.queue.Verify( q => q.AddEvent(It.Is <FSMovedEvent>(e => e.OldPath == oldPath && e.Name == newName && e.IsDirectory == false && e.LocalPath == newPath)), Times.Once()); this.queue.VerifyThatNoOtherEventIsAddedThan <FSMovedEvent>(); }