Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        private static void applySettings(ConfigGraph config, BehaviorGraph graph, IActivationDiagnostics diagnostics, IFubuApplicationFiles files)
        {
            // Might come back to this.
            config.Imports.Each(x => x.InitializeSettings(graph));
            config.Settings.Each(x => x.Alter(graph.Settings));

            var viewSettings = graph.Settings.Get<ViewEngineSettings>();

            var views = viewSettings.BuildViewBag(graph, diagnostics, files);

            var conneg = graph.Settings.Get<ConnegSettings>();

            conneg.ReadConnegGraph(graph);
            conneg.StoreViews(views);
        }
Ejemplo n.º 5
0
        private static void applySettings(ConfigGraph config, BehaviorGraph graph, IActivationDiagnostics diagnostics, IFubuApplicationFiles files)
        {
            // Might come back to this.
            config.Imports.Each(x => x.InitializeSettings(graph));
            config.Settings.Each(x => x.Alter(graph.Settings));

            var viewSettings = graph.Settings.Get <ViewEngineSettings>();


            var views = viewSettings.BuildViewBag(graph, diagnostics, files);

            var conneg = graph.Settings.Get <ConnegSettings>();


            conneg.ReadConnegGraph(graph);
            conneg.StoreViews(views);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public void ImportGlobals(ConfigGraph config)
 {
     Global.Explicits.Import(config.Global.Explicits);
     Global.Policies.Import(config.Global.Policies);
     Global.Reordering.Import(config.Global.Reordering);
 }
Ejemplo n.º 8
0
 public void ImportGlobals(ConfigGraph config)
 {
     Global.Explicits.Import(config.Global.Explicits);
     Global.Policies.Import(config.Global.Policies);
     Global.Reordering.Import(config.Global.Reordering);
 }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        public void push_fubu_registry()
        {
            var registry = new SomeFubuRegistry();
            var graph = new ConfigGraph();
            graph.Push(registry);

            graph.CurrentProvenance.Single().ShouldEqual(new FubuRegistryProvenance(registry));
        }
Ejemplo n.º 11
0
        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));
        }
Ejemplo n.º 12
0
        public void push_bottle()
        {
            var bottle = new AssemblyPackageInfo(Assembly.GetExecutingAssembly());
            var graph = new ConfigGraph();

            graph.Push(bottle);

            graph.CurrentProvenance.ShouldHaveTheSameElementsAs(new BottleProvenance(bottle));
        }
Ejemplo n.º 13
0
        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));
            });
        }