Ejemplo n.º 1
0
        public IEnumerable<IDirectiveRunner> BuildRunnersFor(HostManifest host)
        {
            foreach (var directive in host.BuildDirectives(_types))
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return runner;
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <IDirectiveRunner> BuildRunnersFor(HostManifest host)
        {
            foreach (var directive in host.BuildDirectives(_types))
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return(runner);
            }
        }
        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 directives = host.BuildDirectives(registry);

            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);
        }
Ejemplo n.º 4
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 directives = host.BuildDirectives(registry);

            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);
        }
Ejemplo n.º 5
0
        // overridden in testing classes
        public virtual void BuildDirectives(DeploymentPlan plan, HostManifest host, IDirectiveTypeRegistry typeRegistry)
        {
            var provider = SettingsProvider.For(host.AllSettingsData().Union(plan.Substitutions()).ToArray());

            host.BuildDirectives(provider, typeRegistry);
        }