public void FilterDeletesFsEventsIfLocalFileSystemContainsTheElementOfTheStorage() {
            string path = "path";
            Guid guid = Guid.NewGuid();
            var storage = new Mock<IMetaDataStorage>();
            var fsFactory = new Mock<IFileSystemInfoFactory>();
            fsFactory.AddFile(path, guid, true);
            storage.AddLocalFile(path, "id", guid);
            var filter = new IgnoreAlreadyHandledFsEventsFilter(storage.Object, fsFactory.Object);
            var fsEvent = Mock.Of<IFSEvent>(
                e =>
                e.LocalPath == path &&
                e.Type == WatcherChangeTypes.Deleted &&
                e.IsDirectory== false);

            Assert.That(filter.Handle(fsEvent), Is.True);
        }
        public void FilterHandlesAlreadyExistingFileEntries() {
            string path = "path";
            var storage = new Mock<IMetaDataStorage>();
            var fsFactory = new Mock<IFileSystemInfoFactory>();
            var filter = new IgnoreAlreadyHandledFsEventsFilter(storage.Object, fsFactory.Object);

            var fsEvent = new Mock<IFSEvent>();
            fsEvent.Setup(e => e.IsDirectory).Returns(false);
            fsEvent.Setup(e => e.LocalPath).Returns(path);
            fsEvent.Setup(e => e.Type).Returns(WatcherChangeTypes.Created);

            fsFactory.AddFile(path);
            storage.Setup(s => s.GetObjectByLocalPath(It.Is<IFileSystemInfo>(p => p.FullName.Equals(path)))).Returns(Mock.Of<IMappedObject>());

            Assert.That(filter.Handle(fsEvent.Object), Is.True);
        }