Ejemplo n.º 1
0
        public void structure()
        {
            MyAssert.ContainsExactly(
                new[] { "content.txt" },
                pool.Root.Files.Select(f => f.Name));
            MyAssert.ContainsExactly(
                new[] { "a", "b", "common" },
                pool.Root.Directories.Select(d => d.Name));

            var a = pool.Root.Directories.First(d => d.Name == "a");

            MyAssert.ContainsExactly(
                new[] { "hello.txt" },
                a.Files.Select(f => f.Name));
            Assert.IsEmpty(a.Directories);

            var b = pool.Root.Directories.First(d => d.Name == "b");

            MyAssert.ContainsExactly(
                new[] { "hello.txt" },
                b.Files.Select(f => f.Name));
            Assert.IsEmpty(b.Directories);

            var common = pool.Root.Directories.First(d => d.Name == "common");

            MyAssert.ContainsExactly(
                new[] { "content.txt", "a.txt", "b.txt" },
                common.Files.Select(f => f.Name));
            Assert.IsEmpty(common.Directories);
        }
Ejemplo n.º 2
0
        public void structure([ValueSource(nameof(testPools))] IResourcePool pool)
        {
            MyAssert.ContainsExactly(
                new[] { "answer.txt", "hello.txt" },
                pool.Root.Files.Select(f => f.Path.ToPOSIXString()));
            MyAssert.ContainsExactly(
                new[] { "a" },
                pool.Root.Directories.Select(d => d.Path.ToPOSIXString()));

            var a = pool.Root.Directories.Single();

            MyAssert.ContainsExactly(
                new IResource[0],
                a.Files);
            MyAssert.ContainsExactly(
                new[] { "a/b", "a/c" },
                a.Directories.Select(d => d.Path.ToPOSIXString()));

            var b = a.Directories.Single(d => d.Path.Parts.Last() == "b");

            MyAssert.ContainsExactly(
                new[] { "a/b/content.txt" },
                b.Files.Select(f => f.Path.ToPOSIXString()));
            MyAssert.ContainsExactly(
                new IResource[0],
                b.Directories);

            var c = a.Directories.Single(d => d.Path.Parts.Last() == "c");

            MyAssert.ContainsExactly(
                new[] { "a/c/content.txt" },
                c.Files.Select(f => f.Path.ToPOSIXString()));
            MyAssert.ContainsExactly(
                new IResource[0],
                c.Directories);
        }
Ejemplo n.º 3
0
 public void enumeratorVsSplit([ValueSource(nameof(testPools))] IResourcePool pool) => VisitResources(pool, res =>
 {
     MyAssert.ContainsExactly(res, res.Files.Concat(res.Directories));
 });