public dynamic Compile(string[] args) { var compEnv = new AppCfgEnvironmentCompiler(); var compConfigfile = new AppCfgConfigfileCompiler(_schema.Filepath); var compCommandline = new AppCfgCommandlineCompiler(args); var cfg = new Dictionary <string, object>(); var route = Determine_route(args); cfg["_RoutePath"] = route.Path; compEnv.Compile(route, cfg); compConfigfile.Compile(route, cfg); compCommandline.Compile(route, cfg); return(Finalize(route, cfg)); }
public void Compile_uses_special_environment_varname_without_route_prefix() { var route = new Route("") .Param("pOne", environmentVarName: "NOPREFIXPARAMNAME"); var schema = new AppCfgSchema( "", new Route[0] ); var sut = new AppCfgEnvironmentCompiler(); var cfg = new Dictionary <string, object>(); sut.Compile(route, cfg); Assert.AreEqual("noprefix", cfg["pOne"]); }
public void Compile_skips_missing() { var route = new Route("") .Param("param1", "p1 pOne") .Param("missing"); var schema = new AppCfgSchema( "", new Route[0] ); var sut = new AppCfgEnvironmentCompiler(); var cfg = new Dictionary <string, object>(); sut.Compile(route, cfg); Assert.AreEqual(1, cfg.Count); Assert.AreEqual("1", cfg["param1"]); }
public void Compile() { var route = new Route("") .Param("param1", "p1 pOne") .Param("param2"); var schema = new AppCfgSchema( "", new Route[0] ); var sut = new AppCfgEnvironmentCompiler(); dynamic cfg = new ExpandoObject(); sut.Compile(route, cfg); Assert.AreEqual("1", cfg.param1); Assert.AreEqual("2", cfg.param2); }