FS moved event.
Inheritance: FSEvent, IFSMovedEvent
        public void TransformFSMovedEventToDeletedEvent() {
            this.SetupMocks();
            string fileName = "file.txt";
            var oldFile = Path.Combine(Path.GetTempPath(), fileName);
            var newFile = Path.Combine(this.ignoredLocalPath, fileName);
            var moveFile = new FSMovedEvent(oldFile, newFile, false);

            Assert.That(this.underTest.Handle(moveFile), Is.True);

            this.queue.Verify(q => q.AddEvent(It.Is<FSEvent>(e => !e.IsDirectory && e.LocalPath == oldFile && e.Type == WatcherChangeTypes.Deleted)), Times.Once);
            this.queue.VerifyThatNoOtherEventIsAddedThan<FSEvent>();
        }
Example #2
0
        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);
        }
Example #3
0
        public void FilterLocalFSRenamedEvents() {
            this.SetupMocks();
            var fileEvent = new FSMovedEvent(Path.Combine(this.ignoredPath, "old_file.txt"), Path.Combine(this.ignoredPath, "file.txt"), false);

            Assert.That(this.underTest.Handle(fileEvent), Is.True);
        }
        public void DoNotTransformFSIgnoredFolderMovedEventToAddedEvent() {
            this.SetupMocks();
            string fileName = "folder";
            var oldFile = Path.Combine(this.ignoredLocalPath);
            var newFile = Path.Combine(Path.GetTempPath(), fileName);
            var moveFile = new FSMovedEvent(oldFile, newFile, true);

            Assert.That(this.underTest.Handle(moveFile), Is.False);

            this.queue.VerifyThatNoEventIsAdded();
        }