Esempio n. 1
0
        public void all_explicitly_changed_settings_should_get_registered_as_a_service()
        {
            var registry = new FubuRegistry();

            var oneSettings = new OneSettings();

            registry.ReplaceSettings(oneSettings);
            var twoSettings = new TwoSettings();

            registry.ReplaceSettings(twoSettings);
            var threeSettings = new ThreeSettings();

            registry.ReplaceSettings(threeSettings);

            var graph = BehaviorGraph.BuildFrom(registry);

            graph.Services.DefaultServiceFor <OneSettings>().Value.ShouldBeTheSameAs(oneSettings);
            graph.Services.DefaultServiceFor <TwoSettings>().Value.ShouldBeTheSameAs(twoSettings);
            graph.Services.DefaultServiceFor <ThreeSettings>().Value.ShouldBeTheSameAs(threeSettings);
        }
        public void replace_settings()
        {
            var settings1 = new SettingsObject();

            var registry = new FubuRegistry();

            registry.ReplaceSettings(settings1);

            BehaviorGraph.BuildFrom(registry).Settings.Get <SettingsObject>()
            .ShouldBeTheSameAs(settings1);
        }
Esempio n. 3
0
        public void all_explicitly_changed_settings_should_get_registered_as_a_service()
        {
            var registry = new FubuRegistry();

            var oneSettings = new OneSettings();

            registry.ReplaceSettings(oneSettings);
            var twoSettings = new TwoSettings();

            registry.ReplaceSettings(twoSettings);
            var threeSettings = new ThreeSettings();

            registry.ReplaceSettings(threeSettings);

            using (var runtime = registry.ToRuntime())
            {
                var container = runtime.Get <IContainer>();
                container.DefaultRegistrationIs(oneSettings);
                container.DefaultRegistrationIs(twoSettings);
                container.DefaultRegistrationIs(threeSettings);
            }
        }
        public void Configure(FubuRegistry registry)
        {
            var types = new TypePool();

            types.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies());
            types.IgnoreExportTypeFailures = true;

            // Some ugly Generic trickery
            types.TypesMatching(IsGridDefinitionType).Each(type => {
                typeof(Loader <>).CloseAndBuildAs <ILoader>(type).Apply(registry);
            });


            var policies = new ColumnPolicies();

            registry.ReplaceSettings(policies);

            registry.Services(x => x.AddService <IColumnPolicies>(policies));
        }
Esempio n. 5
0
        public void Configure(FubuRegistry registry)
        {
            registry.AlterSettings <CommonViewNamespaces>(x => {
                x.AddForType <FubuDocsRegistry>();
                x.AddForType <TopicLinkTag>();
                x.AddForType <CommandSectionTag>();
                x.Add("FubuMVC.CodeSnippets");
            });

            registry.Services(x => {
                x.SetServiceIfNone <ITopicTokenCache, TopicTokenCache>();
                x.AddService <IPropertyBinder, RequestLogPropertyBinder>();
                x.ReplaceService <ITopicContext, TopicContext>();
                x.ReplaceService <ICommandDocumentationSource, CommandDocumentationSource>();
            });

            registry.ReplaceSettings(TopicGraph.AllTopics);
            registry.Policies.Add <DocumentationProjectLoader>();
            registry.Policies.Add <SetHomePage>();
        }