Пример #1
0
        public void SetUp()
        {
            UrlContext.Reset();

            var registry = new FubuRegistry();

            registry.Actions.IncludeType <OneController>();
            registry.Actions.IncludeType <TwoController>();
            registry.Actions.ExcludeMethods(x => x.Method.Name.Contains("Ignore"));

            registry.Routes
            .IgnoreControllerFolderName()
            .IgnoreNamespaceForUrlFrom <UrlRegistryIntegrationTester>()
            .IgnoreClassSuffix("Controller");


            registry.ResolveTypes(x => x.AddStrategy <UrlModelForwarder>());

            // need to do forwards



            graph = registry.BuildGraph();

            var resolver = graph.Services.DefaultServiceFor <ITypeResolver>().Value;

            urls = new UrlRegistry(new ChainResolver((ITypeResolver)resolver, graph), new JQueryUrlTemplate());
        }
        public void SetUp()
        {
            _theCurrentHttpRequest = new StubCurrentHttpRequest {
                TheApplicationRoot = "http://server/fubu"
            };



            var registry = new FubuRegistry();

            registry.Actions.IncludeType <OneController>();
            registry.Actions.IncludeType <TwoController>();
            registry.Actions.IncludeType <QueryStringTestController>();
            registry.Actions.IncludeType <OnlyOneActionController>();
            registry.Actions.ExcludeMethods(x => x.Name.Contains("Ignore"));

            registry.Routes
            .IgnoreControllerFolderName()
            .IgnoreNamespaceForUrlFrom <UrlRegistryIntegrationTester>()
            .IgnoreClassSuffix("Controller");


            registry.ResolveTypes(x => x.AddStrategy <UrlModelForwarder>());
            registry.Routes.HomeIs <DefaultModel>();

            graph = registry.BuildGraph();

            var resolver = graph.Services.DefaultServiceFor <ITypeResolver>().Value;

            urls = new UrlRegistry(new ChainResolutionCache((ITypeResolver)resolver, graph), new JQueryUrlTemplate(), _theCurrentHttpRequest);
        }
        public void can_register_new_type_resolution_strategies()
        {
            var registry = new FubuRegistry();

            registry.ResolveTypes(x => x.AddStrategy <ProxyDetector>());

            var graph = registry.BuildGraph();

            var resolver = graph.Services.DefaultServiceFor <ITypeResolver>().Value.ShouldBeOfType <TypeResolver>();

            resolver.ResolveType(new Proxy <UniqueInput>()).ShouldEqual(typeof(UniqueInput));
        }
        private AuthorizationPreviewService withAuthorizationRules(Action <BehaviorGraph> configure)
        {
            var registry = new FubuRegistry();


            registry.Actions.IncludeType <OneController>();
            registry.Actions.IncludeType <TwoController>();

            registry.ResolveTypes(x => x.AddStrategy <UrlModelForwarder>());

            registry.Configure(configure);

            var container = new Container();

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

            return(container.GetInstance <AuthorizationPreviewService>());
        }
        private AuthorizationPreviewService withAuthorizationRules(Action <BehaviorGraph> configure)
        {
            var registry = new FubuRegistry();


            registry.Actions.IncludeType <OneController>();
            registry.Actions.IncludeType <TwoController>();

            registry.ResolveTypes(x => x.AddStrategy <UrlModelForwarder>());

            registry.Configure(configure);

            var container    = new Container();
            var bootstrapper = new StructureMapBootstrapper(container, registry);

            bootstrapper.Bootstrap(new List <RouteBase>());

            return(container.GetInstance <AuthorizationPreviewService>());
        }