public void try_to_attach_views_from_packages_exports_facility_to_imports() { _parent.Import(_child, "import"); _parent.BuildGraph(); _facility1.Invocations.ShouldEqual(2); }
public void should_limit_requests_to_fifty() { var config = new DiagnosticsConfiguration(); _registry .Services(x => { config = x.FindAllValues <DiagnosticsConfiguration>().First(); }); _registry.BuildGraph(); config.MaxRequests.ShouldEqual(50); }
public void conneg_attachement_policy_finds_and_applies_resource_configuration() { var registry = new FubuRegistry(); registry.Applies.ToThisAssembly(); registry.Actions.IncludeType <RestController1>(); registry.Media.ApplyContentNegotiationToActions(x => true); var graph = registry.BuildGraph(); var connegOutput = graph .BehaviorFor <RestController1>(x => x.Find(null)) .ConnegOutputNode(); var writerNode = connegOutput.Writers.Single().As <MediaWriterNode>(); // Assert the xml media var objectDef = writerNode.As <IContainerModel>().ToObjectDef(DiagnosticLevel.None); var document = objectDef.DependencyFor <IMediaDocument>().ShouldBeOfType <ConfiguredDependency>(); document.DependencyType.ShouldEqual(typeof(IMediaDocument)); document.Definition.Type.ShouldEqual(typeof(XmlMediaDocument)); document.Definition.DependencyFor <XmlMediaOptions>().ShouldBeOfType <ValueDependency>() .Value.ShouldBeOfType <XmlMediaOptions>().Namespace.ShouldEqual("something.xsd"); objectDef.DependencyFor <ILinkSource <Address> >().ShouldBeOfType <ValueDependency>() .Value.ShouldNotBeNull(); objectDef.DependencyFor <IProjection <Address> >().ShouldBeOfType <ValueDependency>() .Value.ShouldBeOfType <Projection <Address> >(); }
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 static BehaviorGraph BuildFrom(Action <FubuRegistry> configure) { var registry = new FubuRegistry(); configure(registry); return(registry.BuildGraph()); }
public void SetUp() { var registry = new FubuRegistry(); registry.Import <BasicLocalizationSupport>(); graphWithBasicLocalizationAsIs = registry.BuildGraph(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <AuthorizedController2>(); graph = registry.BuildGraph(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <Controller1>(); theGraph = registry.BuildGraph(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <AuthorizedByAttributeConventionController>(); graph = registry.BuildGraph(); }
public void SetUp() { theFubuRegistry = new FubuRegistry(); theFubuRegistry.Applies.ToThisAssembly(); theFubuRegistry.Actions.IncludeType <Controller1>(); theGraph = new Lazy <BehaviorGraph>(() => theFubuRegistry.BuildGraph()); }
public void register_a_non_default_culture_info() { var registry = new FubuRegistry(); registry.Import <BasicLocalizationSupport>(x => x.DefaultCulture = new CultureInfo("en-CA")); registry.BuildGraph().Services.DefaultServiceFor(typeof(CultureInfo)) .Value.ShouldEqual(new CultureInfo("en-CA")); }
public void apply_the_simplistic_asset_combination_approach() { var registry = new FubuRegistry(); registry.Assets.CombineAllUniqueAssetRequests(); registry.BuildGraph().Services.DefaultServiceFor <ICombinationDeterminationService>() .Type.ShouldEqual(typeof(CombineAllUniqueSetsCombinationDeterminationService)); }
private void registeredTypeIs <TService, TImplementation>() { var fubuRegistry = new FubuRegistry(); fubuRegistry.Import <WebFormsEngine>(); fubuRegistry.BuildGraph().Services.DefaultServiceFor <TService>().Type.ShouldEqual( typeof(TImplementation)); }
public void YSOD_true() { var registry = new FubuRegistry(); registry.Assets.YSOD_on_missing_assets(true); registry.BuildGraph().Services.DefaultServiceFor <IMissingAssetHandler>() .Type.ShouldEqual(typeof(YellowScreenMissingAssetHandler)); }
public void register_a_custom_missing_asset_handler() { var registry = new FubuRegistry(); registry.Assets.HandleMissingAssetsWith <MyDifferentMissingAssetHandler>(); registry.BuildGraph().Services.DefaultServiceFor <IMissingAssetHandler>() .Type.ShouldEqual(typeof(MyDifferentMissingAssetHandler)); }
private BehaviorGraph setupActions() { var registry = new FubuRegistry(); registry.Route("a/m1").Calls<Action1>(a => a.M1()); registry.Route("a/m2").Calls<Action1>(a => a.M2()); registry.Route("b/m1").Calls<Action2>(b => b.M1()); registry.Route("b/m2").Calls<Action2>(b => b.M2()); return registry.BuildGraph(); }
public void YSOD_false() { var registry = new FubuRegistry(); registry.Assets.YSOD_on_missing_assets(false); registry.BuildGraph().Services.DefaultServiceFor <IMissingAssetHandler>() .Type.ShouldEqual(typeof(TraceOnlyMissingAssetHandler)); }
public void SetUp() { var registry = new FubuRegistry(); registry.Views.RegisterActionLessViews(WebFormViewFacility.IsWebFormControl, chain => chain.IsPartialOnly = true); theBehaviorGraph = registry.BuildGraph(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <Controller1>(); registry.Media.ApplyContentNegotiationToActions(call => true); theGraph = registry.BuildGraph(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <WrapWithAttributeController>(); graph = registry.BuildGraph(); graph.BehaviorChainCount.ShouldBeGreaterThan(0); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions .IncludeType <AllowRoleController>() .IncludeType <AllowRoleController2>(); graph = registry.BuildGraph(); }
protected override void beforeEach() { var registry = new FubuRegistry(); registry.IncludeDiagnostics(true); registry.Actions.IncludeType <Hello>(); theGraph = registry.BuildGraph(); ClassUnderTest.Configure(theGraph); }
public void uses_the_resource_path_to_do_its_job() { var registry = new FubuRegistry(); registry.Actions.IncludeType <Controller1>(); registry.BuildGraph().BehaviorFor <Controller1>(x => x.get_resource(null)).Route.CreateUrlFromInput( new ResourcePath("something/else")) .ShouldEqual("resource/something/else"); }
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(); }
public void wraps_handled_actions_with_exception_wrapper() { var registry = new FubuRegistry(r => r.ApplyConvention <APIExceptionConvention <Error500Request> >()); registry.Actions.IncludeType <Action>(); var graph = registry.BuildGraph(); graph.BehaviorFor <Action>(x => x.ApiMethod(null)).IsWrappedBy(typeof(ActionExceptionWrapper <Error500Request>)).ShouldBeTrue(); }
public void SetUp() { var registry = new FubuRegistry(x => { x.Applies.ToThisAssembly(); x.Actions.IncludeClassesSuffixedWithController(); }); theGraph = registry.BuildGraph(); }
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(); }
public void SetUp() { var registry = new FubuRegistry(); registry.Actions.IncludeType <RestController1>(); registry.Media.ApplyContentNegotiationToActions(x => x.HandlerType == typeof(RestController1) && !x.Method.Name.StartsWith("Not")); theBehaviorGraph = registry.BuildGraph(); theConnegGraph = new ConnegGraph(theBehaviorGraph); }
public void register_a_combination_policy_with_CombineWith() { var registry = new FubuRegistry(); registry.Assets .CombineWith <CombineAllScriptFiles>() .CombineWith <CombineAllStylesheets>(); registry.BuildGraph().Services.ServicesFor(typeof(ICombinationPolicy)) .Select(x => x.Type).ShouldHaveTheSameElementsAs(typeof(CombineAllScriptFiles), typeof(CombineAllStylesheets)); }
public static void Activate(this IContainerFacility facility, ICollection<RouteBase> routes, FubuRegistry registry) { // "Bake" the fubu configuration model into your // IoC container for the application var graph = registry.BuildGraph(); graph.EachService(facility.Register); var factory = facility.BuildFactory(); // Register all the Route objects into the routes // collection // TODO -- need a way to do this with debugging graph.VisitRoutes(x => { x.Actions += (routeDef, chain) => { var route = routeDef.ToRoute(); route.RouteHandler = new FubuRouteHandler(factory, chain.UniqueId); routes.Add(route); }; }); }