コード例 #1
0
        public void Configure(FubuRegistry registry)
        {
            registry.Policies.Local.Add <SpecialPolicy>();
            registry.Import <SubModule>();

            Applied++;
        }
        public void is_registered()
        {
            var registry = new FubuRegistry();
            registry.Import<ViewEnginesExtension>();
            registry.AlterSettings<CommonViewNamespaces>(x =>
            {
                x.Add("Foo");
                x.Add("Bar");
            });

            var graph = BehaviorGraph.BuildFrom(registry);
            var useNamespaces = graph.Services.DefaultServiceFor<CommonViewNamespaces>().Value.As<CommonViewNamespaces>();
            useNamespaces.Namespaces.Each(x => Debug.WriteLine(x));

            useNamespaces.Namespaces.ShouldHaveTheSameElementsAs(new[]
            { 
                typeof(VirtualPathUtility).Namespace,
                typeof(string).Namespace,
                typeof(FileSet).Namespace,
                typeof(ParallelQuery).Namespace,
                typeof(HtmlTag).Namespace,
                "Foo",
                "Bar",
            });
        }
コード例 #3
0
        public void default_namespaces_are_set_including_anything_from_CommonViewNamespaces()
        {
            var registry = new FubuRegistry();

            registry.Import <RazorViewFacility>();
            registry.AlterSettings <CommonViewNamespaces>(x =>
            {
                x.Add("Foo");
                x.Add("Bar");
            });

            var graph         = BehaviorGraph.BuildFrom(registry);
            var useNamespaces = graph.Services.DefaultServiceFor <CommonViewNamespaces>().Value.As <CommonViewNamespaces>();

            useNamespaces.Namespaces.ShouldHaveTheSameElementsAs(new[]
            {
                "System.Web",
                "System",
                "FubuCore",
                "System.Linq",
                "HtmlTags",
                "FubuMVC.Core.UI",
                "FubuMVC.Core.UI.Extensions",
                "FubuMVC.Razor",
                "Foo",
                "Bar"
            });
        }
コード例 #4
0
 protected override void configure(FubuRegistry registry)
 {
     registry.Actions.IncludeType<ShowEditEndpoints>();
     registry.Import<HtmlConventionRegistry>(x => {
         x.FieldChrome<TableRowFieldChrome>();
     });
 }
コード例 #5
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <YuiCompressionExtensions>();

            theServices = BehaviorGraph.BuildFrom(registry).Services;
        }
コード例 #6
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <BasicLocalizationSupport>();

            graphWithBasicLocalizationAsIs = BehaviorGraph.BuildFrom(registry);
        }
コード例 #7
0
        public FubuApplication BuildApplication()
        {
            var registry = new FubuRegistry();

            registry.Import <LightningQueuesDiagnosticsTransportRegistry>();

            return(FubuApplication.For(registry).StructureMap());
        }
コード例 #8
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <ApplyWindowsAuthentication>();

            theGraph = BehaviorGraph.BuildFrom(registry);
        }
 protected override void configure(FubuRegistry registry)
 {
     registry.Services(x => x.AddService<IFieldAccessRule, ShowEditFakePolicy>());
     registry.Actions.IncludeType<ShowEditEndpoints>();
     registry.Import<HtmlConventionRegistry>(x => {
         x.Profile("table", profile => profile.FieldChrome<TableRowFieldChrome>());
     });
 }
コード例 #10
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <BasicLocalizationSupport>();

            graphWithBasicLocalizationAsIs = registry.BuildGraph();
        }
コード例 #11
0
        public void Configure(FubuRegistry registry)
        {
//            registry
//                .Import<SassExtension>();

            registry
            .Import <VisualizationFubuRegistry>(DiagnosticsRegistration.DIAGNOSTICS_URL_ROOT);
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Actions.IncludeType <NothingEndpoint>(); // Have to do this to make it an isolated test
            registry.Import <ApplyAuthentication>();

            theGraphWithBasicAuthentication = BehaviorGraph.BuildFrom(registry);
        }
コード例 #13
0
        private void registeredTypeIs <TService, TImplementation>()
        {
            var fubuRegistry = new FubuRegistry();

            fubuRegistry.Import <WebFormsEngine>();

            fubuRegistry.BuildGraph().Services.DefaultServiceFor <TService>().Type.ShouldEqual(
                typeof(TImplementation));
        }
コード例 #14
0
        public void register_a_non_default_culture_info()
        {
            var registry = new FubuRegistry();

            registry.Import <BasicLocalizationSupport>(x => x.DefaultCulture = new CultureInfo("en-CA"));

            BehaviorGraph.BuildFrom(registry).Services.DefaultServiceFor(typeof(CultureInfo))
            .Value.ShouldEqual(new CultureInfo("en-CA"));
        }
コード例 #15
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <WebFormsEngine>();

            registry.Views.RegisterActionLessViews(token => token.ViewType.Name.StartsWith("FakeView"), (chain, token) => chain.Route = new RouteDefinition(token.Name));

            theBehaviorGraph = registry.BuildGraph();
        }
コード例 #16
0
 protected override void configure(FubuRegistry registry)
 {
     registry.Import <SparkEngine>();
     registry.Actions.IncludeType <UsesPartialController>();
     registry.Actions.IncludeType <HelloPartialController>();
     registry.Actions.IncludeType <TransferToController>();
     registry.Actions.IncludeType <RedirectToController>();
     registry.Actions.IncludeType <UsesNativeController>();
     registry.Views.TryToAttachWithDefaultConventions();
 }
コード例 #17
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <WebFormsEngine>();

            registry.Views.RegisterActionLessViews(token => token.ViewType.Name.StartsWith("FakeView"), chain => chain.IsPartialOnly = true);

            theBehaviorGraph = registry.BuildGraph();
        }
コード例 #18
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <WebFormsEngine>();

            registry.Views.RegisterActionLessViews(WebFormViewFacility.IsWebFormControl, chain => chain.IsPartialOnly = true);

            theBehaviorGraph = registry.BuildGraph();
        }
コード例 #19
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <DiagnosticsRegistration>();

            graph = BehaviorGraph.BuildFrom(registry);
            urls  = MockRepository.GenerateMock <IUrlRegistry>();

            graph.Behaviors.Any().ShouldBeTrue();
        }
コード例 #20
0
        public void ensure_namespaces_are_imported()
        {
            var registry = new FubuRegistry();

            registry.Import <ContentExtensionsRegistration>();

            var graph = BehaviorGraph.BuildFrom(registry);
            var commonViewNamespaces = graph.Services.DefaultServiceFor <CommonViewNamespaces>().Value.As <CommonViewNamespaces>();

            commonViewNamespaces.Namespaces.ShouldContain(typeof(ContentExtensionGraph).Namespace);
        }
コード例 #21
0
        public void import_with_strings_instead_of_StringToken()
        {
            var registry = new FubuRegistry();

            registry.Import <NavigationRegistryExtension>();

            registry.Policies.Add <NavigationRegistry>(x =>
            {
                x.ForMenu("Key1");
                x.Add += MenuNode.Node("Key2");
                x.Add += MenuNode.Node("Key3");
            });

            registry.Import <ChildRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry).Settings.Get <NavigationGraph>();

            graph.MenuFor("Key1").Select(x => x.Key)
            .ShouldHaveTheSameElementsAs(new NavigationKey("Key2"), new NavigationKey("Key3"));
        }
コード例 #22
0
        public void the_url_prefix_of_a_fubu_package_registry_should_be_respected()
        {
            var registry = new FubuRegistry();

            registry.Import <FooPackageRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry);

            graph.BehaviorFor <FooEndpointClass>(x => x.get_some_foo())
            .GetRoutePattern().ShouldEqual("moar/some/foo");
        }
        public void should_only_apply_behavior_once()
        {
            var hostRegistry    = new FubuRegistry();
            var packageRegistry = new FubuPackageRegistry();

            packageRegistry.Actions.IncludeType <Controller1>();
            hostRegistry.Import(packageRegistry, string.Empty);
            theGraph = BehaviorGraph.BuildFrom(hostRegistry);

            var chain = chainFor(x => x.BasicContinuation(null))
                        .Output.Writers.OfType <Writer>().ShouldHaveCount(1);
        }
コード例 #24
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Import <DiagnosticsRegistration>();

            graph = BehaviorGraph.BuildFrom(registry);
            urls  = MockRepository.GenerateMock <IUrlRegistry>();

            graph.Behaviors.Any().ShouldBeTrue();
            graph.Actions().Each(x => Debug.WriteLine(x.Description));
        }
コード例 #25
0
        public void adds_chains_from_import_with_a_prefix()
        {
            import.Actions.IncludeType <Action1>();

            parent.Import(import, "import");

            var graph = BehaviorGraph.BuildFrom(parent);

            graph.BehaviorFor <Action1>(x => x.M1()).As <RoutedChain>().GetRoutePattern().ShouldEqual("import/a/m1");
            graph.BehaviorFor <Action1>(x => x.M2()).As <RoutedChain>().GetRoutePattern().ShouldEqual("import/a/m2");
        }
コード例 #26
0
        private void registeredTypeIs <TService, TImplementation>()
        {
            var registry = new FubuRegistry();

            registry.Import <NavigationRegistryExtension>();

            using (var runtime = registry.ToRuntime())
            {
                var container = runtime.Get <IContainer>();

                container.Model.For <TService>().Default.ReturnedType.ShouldBe(typeof(TImplementation));
            }
        }
コード例 #27
0
        public void adds_chains_from_import_with_a_prefix()
        {
            import.Route("a/m1").Calls <Action1>(x => x.M1());
            import.Route("a/m2").Calls <Action1>(x => x.M2());
            parent.Import(import, "import");

            var graph = BehaviorGraph.BuildFrom(parent);

            graph.BehaviorFor <Action1>(x => x.M1()).GetRoutePattern().ShouldEqual("import/a/m1");
            graph.BehaviorFor <Action1>(x => x.M2()).GetRoutePattern().ShouldEqual("import/a/m2");
        }
コード例 #28
0
        public FubuApplication BuildApplication()
        {
            var registry = new FubuRegistry();

            registry.Import <DiagnosticApplication>();

            registry.AlterSettings <TransportSettings>(x => {
                x.DelayMessagePolling    = Int32.MaxValue;
                x.ListenerCleanupPolling = Int32.MaxValue;
            });

            return(FubuApplication.For(registry).StructureMap());
        }
コード例 #29
0
        public void uses_the_specified_OAuthSettings()
        {
            var theSettings = new OAuthSettings {
                ConsumerKey = "blah", ConsumerSecret = "private"
            };
            var registry = new FubuRegistry();

            registry.Import <ApplyTwitterAuthentication>(x => x.UseOAuthSettings(theSettings));

            var graph = BehaviorGraph.BuildFrom(registry);

            graph.Services.DefaultServiceFor <OAuthSettings>().Value.ShouldEqual(theSettings);
        }
コード例 #30
0
        public void should_only_apply_behavior_once()
        {
            var hostRegistry    = new FubuRegistry();
            var packageRegistry = new FubuPackageRegistry();

            packageRegistry.Actions.IncludeType <Controller1>();
            hostRegistry.Import(packageRegistry, string.Empty);
            theGraph = hostRegistry.BuildGraph();

            chainFor(x => x.BasicContinuation(null))
            .Where(x => x is AjaxContinuationNode)
            .ShouldHaveCount(1);
        }
コード例 #31
0
        public void import_navigation_from_child_registry()
        {
            var registry = new FubuRegistry();

            registry.Import <NavigationRegistryExtension>();

            registry.Policies.Add <NavigationRegistry>(x =>
            {
                x.ForMenu(FakeKeys.Key1);
                x.Add += MenuNode.Node(FakeKeys.Key2);
                x.Add += MenuNode.Node(FakeKeys.Key3);
            });

            registry.Import <ChildRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry).Settings.Get <NavigationGraph>();

            graph.MenuFor(FakeKeys.Key1).Select(x => x.Key)
            .ShouldHaveTheSameElementsAs(FakeKeys.Key2, FakeKeys.Key3, FakeKeys.Key4, FakeKeys.Key5);

            graph.MenuFor(FakeKeys.Key6).Select(x => x.Key)
            .ShouldHaveTheSameElementsAs(FakeKeys.Key7, FakeKeys.Key8);
        }
コード例 #32
0
        protected override void configure(FubuRegistry registry)
        {
            registry.Actions.IncludeType <CreateUserEndpoint>();
            registry.Import <FubuMvcValidation>();

            theUserService = new UserService();
            registry.Services(r => r.SetServiceIfNone <IUserService>(theUserService));

            var rule = RemoteFieldRule.For(ReflectionHelper.GetAccessor <CreateUser>(x => x.Username), new UniqueUsernameRule());

            theField = new ValidateField {
                Hash = rule.ToHash(), Value = "joel_arnold"
            };
            theUserService.AddUser(theField.Value);
        }
コード例 #33
0
        private void configurationIs(Action <DateTimePolicies> action)
        {
            container = new Container();
            var registry = new FubuRegistry();

            registry.Services(x =>
            {
                x.SetServiceIfNone <ITimeZoneContext>(theTimeZoneContext);
            });
            registry.Import <DateTimePolicies>(action);

            FubuApplication.For(registry).StructureMap(container).Bootstrap();


            _formatter = container.GetInstance <IDisplayFormatter>();
        }
コード例 #34
0
 void IFubuRegistryExtension.Configure(FubuRegistry registry)
 {
     registry.Import(this, _urlPrefix);
 }
コード例 #35
0
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            registry.Import(this, UrlPrefix);

            registry.Config.ImportGlobals(Config);
        }