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 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); }
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); }
// 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); }