Ejemplo n.º 1
0
        private bool DeleteFile(string path, IReadOnlyList <string> pathSegments)
        {
            if (!filesInfo.Delete(pathSegments, 0))
            {
                return(false);
            }

            changes.OnNext(FileChangedEvent.Deleted(path));
            log.TraceFormat("File {Path} was deleted", path);
            return(true);
        }
Ejemplo n.º 2
0
        public void Test()
        {
            var root = new SegmentTreeNode<int>(StringComparer.InvariantCultureIgnoreCase);

            root.Search(new[] {"a"}, 0).Should().BeEmpty();
            root.Add(new[] {"a", "b", "c"}, 0, 42).Should().BeTrue();
            root.Search(new[] {"a"}, 0).Should().BeEquivalentTo((new[] {"a", "b", "c"}, 42));
            root.Search(new[] {"a", "b"}, 0).Should().BeEquivalentTo((new[] {"a", "b", "c"}, 42));
            root.Search(new[] {"a", "b", "c"}, 0).Should().BeEquivalentTo((new[] {"a", "b", "c"}, 42));
            root.Search(new[] {"a", "b", "c", "d"}, 0).Should().BeEmpty();
            root.Add(new[] {"a", "b"}, 0, 42).Should().BeFalse();
            root.Delete(new[] {"a", "b", "c"}, 0).Should().BeTrue();
            root.Search(new[] {"a"}, 0).Should().BeEmpty();
        }