public void prepend_provenance() { var graph = new ConfigGraph(); var defaultConfigurationPack = new DefaultConfigurationPack(); graph.Add(defaultConfigurationPack); var p1 = MockRepository.GenerateMock <Provenance>(); var p2 = MockRepository.GenerateMock <Provenance>(); graph.PrependProvenance(new Provenance[] { p1, p2 }); graph.LogsFor(ConfigurationType.Conneg).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.ModifyRoutes).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.InjectNodes).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.Attachment).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); }
public void push_bottle() { var bottle = new AssemblyPackageInfo(Assembly.GetExecutingAssembly()); var graph = new ConfigGraph(); graph.Push(bottle); graph.CurrentProvenance.ShouldHaveTheSameElementsAs(new BottleProvenance(bottle)); }
public void push_fubu_registry() { var registry = new SomeFubuRegistry(); var graph = new ConfigGraph(); graph.Push(registry); graph.CurrentProvenance.Single().ShouldEqual(new FubuRegistryProvenance(registry)); }
public void add_configuration_action_with_default_configuration_type() { var graph = new ConfigGraph(Assembly.GetExecutingAssembly()); var action = new IndeterminateAction(); graph.Add(action, ConfigurationType.Explicit); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_action_that_is_marked_with_attribute() { var graph = new ConfigGraph(Assembly.GetExecutingAssembly()); var action = new DeterminateAciton(); graph.Add(action); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_action_with_default_configuration_type() { var graph = new ConfigGraph(); var action = new IndeterminateAction(); graph.Push(new SomeFubuRegistry()); graph.Add(action, ConfigurationType.Explicit); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void push_extension() { var bottle = new AssemblyPackageInfo(Assembly.GetExecutingAssembly()); var graph = new ConfigGraph(); graph.Push(bottle); var extension = new FakeRegistryExtension(); graph.Push(extension); graph.CurrentProvenance.ShouldHaveTheSameElementsAs(new BottleProvenance(bottle), new FubuRegistryExtensionProvenance(extension)); }
public void add_configuration_action_that_is_marked_with_attribute() { var graph = new ConfigGraph(); graph.Push(new SomeFubuRegistry()); var action = new DeterminateAciton(); graph.Add(action); graph.ActionsFor(ConfigurationType.Conneg).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_pak() { var pack = new DiscoveryActionsConfigurationPack(); var graph = new ConfigGraph(); graph.Add(pack); graph.LogsFor(ConfigurationType.Discovery).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(new ConfigurationPackProvenance(pack)); }); graph.LogsFor(ConfigurationType.Discovery).Any().ShouldBeTrue(); }
public void reads_from_attribute() { ConfigGraph.DetermineConfigurationType(new FakePolicy1()) .ShouldEqual(ConfigurationType.Policy); ConfigGraph.DetermineConfigurationType(new FakePolicy2()) .ShouldEqual(ConfigurationType.Explicit); ConfigGraph.DetermineConfigurationType(new FakePolicy3()) .ShouldEqual(ConfigurationType.Policy); ConfigGraph.DetermineConfigurationType(new FakePolicy4()) .ShouldEqual(ConfigurationType.Discovery); }
public void fill_action_puts_the_provenance_in_the_right_order() { var bottle = new AssemblyPackageInfo(Assembly.GetExecutingAssembly()); var graph = new ConfigGraph(); graph.Push(bottle); var extension = new FakeRegistryExtension(); graph.Push(extension); var policy = new UniquePolicy(); graph.Add(policy, ConfigurationType.Policy); graph.LogsFor(ConfigurationType.Policy).Single() .ProvenanceChain.ShouldHaveTheSameElementsAs(new BottleProvenance(bottle), new FubuRegistryExtensionProvenance(extension)); }
public void add_configuration_pack_has_to_be_idempotent() { var pack = new DiscoveryActionsConfigurationPack(); var graph = new ConfigGraph(); graph.Add(pack); var count = graph.LogsFor(ConfigurationType.Discovery).Count(); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.LogsFor(ConfigurationType.Discovery).Count() .ShouldEqual(count); }
public void will_use_the_IKnowMyConfigurationType_if_it_exists() { ConfigGraph.DetermineConfigurationType(new FakePolicy5()) .ShouldEqual(new FakePolicy5().As <IKnowMyConfigurationType>().DetermineConfigurationType()); }
public PoliciesExpression(ConfigGraph configuration) { _configuration = configuration; }
private static void registerServices(ConfigGraph config, BehaviorGraph graph) { graph.Settings.Register(graph.Services); config .AllServiceRegistrations() .OfType<IServiceRegistration>() .Each(x => x.Apply(graph.Services)); graph.Services.AddService(config); }
private static void discoverChains(ConfigGraph config, BehaviorGraph graph) { var chainSources = config.Sources.Union(config.UniqueImports()).ToList(); if (FubuMode.InDevelopment()) { var aggregator = new ActionSourceAggregator(null); aggregator.Add(new RegisterAbout()); chainSources.Add(aggregator); } var tasks = chainSources.Select( x => { return Task.Factory.StartNew(() => { x.BuildChains(graph.Settings).Each(chain => graph.AddChain(chain)); }); }).ToArray(); Task.WaitAll(tasks); }
private static void applySettings(ConfigGraph config, BehaviorGraph graph) { config.Imports.Each(x => x.InitializeSettings(graph)); config.Settings.Each(x => x.Alter(graph.Settings)); graph.Settings.Alter<ConnegSettings>(x => x.Graph = ConnegGraph.Build(graph)); }
public RouteConventionExpression(ConfigGraph configuration) { _configuration = configuration; }
public void reorder_policy_is_reording() { ConfigGraph.DetermineConfigurationType(new ReorderBehaviorsPolicy()) .ShouldEqual(ConfigurationType.Reordering); }
public void lambda_should_be_indeterminate() { ConfigGraph.DetermineConfigurationType(new LambdaConfigurationAction(g => { })) .ShouldEqual(null); }
internal void Import(ConfigGraph graph, IEnumerable <Provenance> forebears) { graph.PrependProvenance(forebears); _allGraphs.Add(graph); }
internal void Import(ConfigGraph graph) { _allGraphs.Add(graph); }
public void should_be_classified_as_a_policy() { ConfigGraph.DetermineConfigurationType(new DownloadFileConvention()) .ShouldEqual(ConfigurationType.Policy); }
public ActionCallCandidateExpression(ConfigGraph configuration) { _configuration = configuration; }
public void ImportGlobals(ConfigGraph config) { Global.Explicits.Import(config.Global.Explicits); Global.Policies.Import(config.Global.Policies); Global.Reordering.Import(config.Global.Reordering); }