Handle() 공개 메소드

Takes rename file system events and transforms them to rename events on queue.
public Handle ( object source, RenamedEventArgs e ) : void
source object source object
e System.IO.RenamedEventArgs Rename event from file system watcher
리턴 void
        public void HandleRenameFolderEvent() {
            var handler = new RenamedFileSystemEventHandler(this.queue.Object, this.fsFactory.Object);
            string newPath = Path.Combine(RootPath, this.newName);
            string oldPath = Path.Combine(RootPath, this.oldName);
            this.fsFactory.Setup(f => f.IsDirectory(newPath)).Returns((bool?)true);

            handler.Handle(null, this.CreateEvent(this.oldName, this.newName));

            this.queue.Verify(
                q =>
                q.AddEvent(
                It.Is<FSMovedEvent>(e => e.OldPath == oldPath && e.Name == this.newName && e.IsDirectory == true && e.LocalPath == newPath)),
                Times.Once());
            this.queue.VerifyThatNoOtherEventIsAddedThan<FSMovedEvent>();
        }
        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 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);
        }