Handle() public méthode

Handle the specified Event if it is FSEvent.
public Handle ( ISyncEvent e ) : bool
e ISyncEvent /// The Event. ///
Résultat bool
        public void HandleFSFileAddedEvents()
        {
            this.queue.Setup(q => q.AddEvent(It.IsAny<AbstractFolderEvent>()))
                .Callback((ISyncEvent f) => this.returnedFileEvent = f as AbstractFolderEvent);
            var watcher = new WatcherConsumer(this.queue.Object);

            var fileCreatedFSEvent = new FSEvent(WatcherChangeTypes.Created, this.localFile.FullName, false);
            Assert.True(watcher.Handle(fileCreatedFSEvent));
            Assert.AreEqual(MetaDataChangeType.CREATED, this.returnedFileEvent.Local);
            Assert.AreEqual(ContentChangeType.CREATED, (this.returnedFileEvent as FileEvent).LocalContent);
            Assert.AreEqual(this.localFile.FullName, (this.returnedFileEvent as FileEvent).LocalFile.FullName);
            Assert.IsNull((this.returnedFileEvent as FileEvent).RemoteFile);
            Assert.AreEqual(MetaDataChangeType.NONE, (this.returnedFileEvent as FileEvent).Remote);
            Assert.AreEqual(ContentChangeType.NONE, (this.returnedFileEvent as FileEvent).RemoteContent);
        }
        public void HandleFSFolderRenamedEvents()
        {
            string oldpath = Path.Combine(this.localFolder.FullName, Path.GetRandomFileName());
            this.queue.Setup(q => q.AddEvent(It.IsAny<AbstractFolderEvent>()))
                .Callback((ISyncEvent f) => this.returnedFolderEvent = f as AbstractFolderEvent);
            var watcher = new WatcherConsumer(this.queue.Object);

            var folderRenamedFSEvent = new FSMovedEvent(oldpath, this.localFolder.FullName, true);
            Assert.True(watcher.Handle(folderRenamedFSEvent));
            Assert.AreEqual(MetaDataChangeType.MOVED, this.returnedFolderEvent.Local);
            Assert.AreEqual(this.localFolder.FullName, (this.returnedFolderEvent as FolderEvent).LocalFolder.FullName);
            Assert.AreEqual(oldpath, (this.returnedFolderEvent as FolderMovedEvent).OldLocalFolder.FullName);
            Assert.IsNull((this.returnedFolderEvent as FolderMovedEvent).RemoteFolder);
            Assert.IsNull((this.returnedFolderEvent as FolderMovedEvent).OldRemoteFolderPath);
            Assert.AreEqual(MetaDataChangeType.NONE, (this.returnedFolderEvent as FolderEvent).Remote);
        }
 public void IgnoreWrongEventsTest()
 {
     this.queue.Verify(q => q.AddEvent(It.IsAny<ISyncEvent>()), Times.Never());
     var watcher = new WatcherConsumer(this.queue.Object);
     Assert.False(watcher.Handle(new Mock<ISyncEvent>().Object));
     Assert.False(watcher.Handle(new Mock<FileEvent>(new Mock<IFileInfo>().Object, null) { CallBase = false }.Object));
 }
        public void HandleFSFolderRemovedEvents()
        {
            this.queue.Setup(q => q.AddEvent(It.IsAny<AbstractFolderEvent>()))
                .Callback((ISyncEvent f) => this.returnedFolderEvent = f as AbstractFolderEvent);
            var watcher = new WatcherConsumer(this.queue.Object);

            var folderRemovedFSEvent = new FSEvent(WatcherChangeTypes.Deleted, this.localFolder.FullName, true);
            Assert.True(watcher.Handle(folderRemovedFSEvent));
            Assert.AreEqual(MetaDataChangeType.DELETED, this.returnedFolderEvent.Local);
            Assert.AreEqual(this.localFolder.FullName, (this.returnedFolderEvent as FolderEvent).LocalFolder.FullName);
            Assert.IsNull((this.returnedFolderEvent as FolderEvent).RemoteFolder);
            Assert.AreEqual(MetaDataChangeType.NONE, (this.returnedFolderEvent as FolderEvent).Remote);
        }