コード例 #1
0
        public static async Task Provision_recursive_dir_in()
        {
            var directory = new DirectoryBuilder("root");

            directory.Directory("out");
            var cfg = directory.Directory("cfg");
            var src = directory.Directory("src");
            var lib = src.Directory("lib").Directory("config");

            directory.TextFile("package.json").Code.Append("{ \"private\": true }");
            cfg.TextFile("config.ini").Code.Append("SOME_CONFIG = 'SOME VALUE'");
            src.TextFile("index.js").Code.Append("require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
            lib.TextFile("config.js").Code.Append("// Test.");

            await directory.ProvisionInAsync(Tmp);

            AssertDirectory("root", 4);
            AssertDirectory(Path.Join("root", "cfg"), 1);
            AssertDirectory(Path.Join("root", "src"), 2);
            AssertDirectory(Path.Join("root", "src", "lib"), 1);
            AssertDirectory(Path.Join("root", "src", "lib", "config"), 1);
            AssertDirectory(Path.Join("root", "out"), 0);

            AssertFile(Path.Join("root", "package.json"), "{ \"private\": true }");
            AssertFile(Path.Join("root", "cfg", "config.ini"), "SOME_CONFIG = 'SOME VALUE'");
            AssertFile(Path.Join("root", "src", "index.js"), "require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
            AssertFile(Path.Join("root", "src", "lib", "config", "config.js"), "// Test.");
        }
コード例 #2
0
        public static async Task Provision_simple_dir_in()
        {
            var directory = new DirectoryBuilder("src");

            directory.TextFile("config.ini").Code.Append("SOME_CONFIG = 'SOME VALUE'");
            directory.TextFile("index.js").Code.Append("require('config').getFromFile('./config.txt').log('SOME_CONFIG')");

            await directory.ProvisionInAsync(Tmp);

            AssertDirectory("", 1);
            AssertDirectory("src", 2);

            AssertFile(Path.Join("src", "config.ini"), "SOME_CONFIG = 'SOME VALUE'");
            AssertFile(Path.Join("src", "index.js"), "require('config').getFromFile('./config.txt').log('SOME_CONFIG')");
        }