コード例 #1
0
        public void HostManifest_can_create_all_directives_for_itself()
        {
            var host = new HostManifest("h1");
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Age, 11);
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Name, "Robert");

            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Direction, "North");
            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Threshold, 5);

            var registry = theContainer.GetInstance<DirectiveTypeRegistry>();

            var factory = theContainer.GetInstance<DirectiveRunnerFactory>();

            var profile = new Profile("profile1");
            profile.AddRecipe("something");

            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph(){
                Environment = new EnvironmentSettings(),
                Profile = profile,
                Recipes = new Recipe[]{new Recipe("something"), },
                Settings = new DeploymentSettings()

            });

            factory.BuildDirectives(plan, host, registry);
            var directives = host.Directives;

            directives.Count().ShouldEqual(2);
            var directiveOne = directives.OfType<BottleDeployers1.OneDirective>().Single();
            directiveOne.Age.ShouldEqual(11);
            directiveOne.Name.ShouldEqual("Robert");

            var directiveSix = directives.OfType<SixDirective>().Single();
            directiveSix.Direction.ShouldEqual("North");
            directiveSix.Threshold.ShouldEqual(5);
        }
コード例 #2
0
        public void SetUp()
        {
            theEnvironment = new EnvironmentSettings();
            theEnvironment.Data["Env1"] = "Env1-Val";
            theEnvironment.Data["Shared"] = "Shared-Env-Val";

            theProfile = new Profile("profile1");
            theProfile.AddRecipe("something");

            theProfile.Data["Shared"] = "Shared-Profile-Val";
            theProfile.Data["Profile1"] = "Profile1-Val";

            theRecipes = new Recipe[] { new Recipe("something"), };
        }