public void resolve_all()
        {
            res.Write("~/x/1.txt", "1", ctx);
            res.Write("~/y/2.txt", "2", ctx);
            var files = res.ResolveAll(ctx, FileSearchResultType.FullPath, new[] { "x", "y" }, new[] { "*.txt" }, log);

            Assert.AreEqual(2, files.Length);
            Assert.AreEqual("1", File.ReadAllText(files[0]));
            Assert.AreEqual("2", File.ReadAllText(files[1]));
        }
Пример #2
0
        public void ResolveAllWithWildCard()
        {
            var f1    = write("usr/a.txt");
            var f2    = write("b.txt");
            var f3    = write("b.zip");
            var files = fr.ResolveAll(new FileSearchQuery
            {
                ExistedOnly = true,
                PathType    = FileSearchResultType.FullPath,
                ProbeFiles  = new[] { "*.txt", "*.zip" },
                ProbePaths  = new[] { "~/", "~/usr" }
            }).ToList();

            Assert.AreEqual(3, files.Count);
            Assert.True(files.Contains(f1.NormalizePath()));
            Assert.True(files.Contains(f2.NormalizePath()));
            Assert.True(files.Contains(f3.NormalizePath()));

            Assert.AreEqual(f2.NormalizePath(), files[0]);
            Assert.AreEqual(f1.NormalizePath(), files[1]);
            Assert.AreEqual(f3.NormalizePath(), files[2]);
        }