public void applies_model_binding_after_serialization_with_json() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbeddedWithAutoPort()) { // TODO -- need a better EndpointDriver first } }
protected void Application_Start(object sender, EventArgs e) { FubuApplication .For <AdnugContinuationsFubuRegistry>() .StructureMapObjectFactory(x => x.AddRegistry <AdnugContinuationsRegistry>()) .Bootstrap(); }
protected void Application_Start(object sender, EventArgs e) { FubuApplication .For(() => new FubuRegistry()) .StructureMap(new Container()) .Bootstrap(); }
public void build_a_full_application() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { runtime.Factory.Get <IJsonWriter>().ShouldNotBeNull(); } }
public static void Start() { setupLoggingConfigurationWatchFile(); // FubuApplication "guides" the bootstrapping of the FubuMVC // application FubuApplication.For <ConfigureFubuMVC>() // ConfigureFubuMVC is the main FubuRegistry // for this application. FubuRegistry classes // are used to register conventions, policies, // and various other parts of a FubuMVC application // FubuMVC requires an IoC container for its own internals. // In this case, we're using a brand new StructureMap container, // but FubuMVC just adds configuration to an IoC container so // that you can use the native registration API's for your // IoC container for the rest of your application .StructureMap(() => { ObjectFactory.Initialize(cfg => cfg.AddRegistry <WebRegistry>()); return(ObjectFactory.Container); }) .Bootstrap(); // Ensure that no errors occurred during bootstrapping PackageRegistry.AssertNoFailures(); }
public void hydrate_through_container_facility_smoke_test() { AssetContentEndpoint.Latched = false; var container = new Container(x => { x.For <IStreamingData>().Use(MockRepository.GenerateMock <IStreamingData>()); x.For <IHttpWriter>().Use(new NulloHttpWriter()); x.For <ICurrentChain>().Use(new CurrentChain(null, null)); x.For <ICurrentHttpRequest>().Use(new StubCurrentHttpRequest { TheApplicationRoot = "http://server" }); x.For <IResourceHash>().Use(MockRepository.GenerateMock <IResourceHash>()); }); FubuApplication.For(() => registry).StructureMap(container).Bootstrap(); container.Model.InstancesOf <IActionBehavior>().Count().ShouldBeGreaterThan(3); var behaviors = container.GetAllInstances <IActionBehavior>().ToArray(); // The first behavior is an InputBehavior behaviors[1].As <BasicBehavior>().InsideBehavior.ShouldBeOfType <ConditionallyWrapBehaviorChainsWithTester.FakeUnitOfWorkBehavior>().Inner. ShouldNotBeNull(); behaviors[2].As <BasicBehavior>().InsideBehavior.ShouldNotBeOfType <ConditionallyWrapBehaviorChainsWithTester.FakeUnitOfWorkBehavior>(); behaviors[3].As <BasicBehavior>().InsideBehavior.ShouldNotBeOfType <ConditionallyWrapBehaviorChainsWithTester.FakeUnitOfWorkBehavior>(); }
public void SetUp() { var container = new Container(); FubuApplication.For(new FubuRegistry()).StructureMap(container).Bootstrap(); registry = container.GetInstance <BindingRegistry>(); }
public void can_get_the_reloaded_time_consistently() { string ts1; string ts2; string ts3; string ts4; using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(port: PortFinder.FindPort(5500))) { ts1 = server.Endpoints.Get <AboutEndpoint>(x => x.get__loaded()).ReadAsText(); ts2 = server.Endpoints.Get <AboutEndpoint>(x => x.get__loaded()).ReadAsText(); } Thread.Sleep(10000); using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(port: PortFinder.FindPort(5500))) { ts3 = server.Endpoints.Get <AboutEndpoint>(x => x.get__loaded()).ReadAsText(); ts4 = server.Endpoints.Get <AboutEndpoint>(x => x.get__loaded()).ReadAsText(); } ts1.ShouldEqual(ts2); ts3.ShouldEqual(ts4); ts1.ShouldNotEqual(ts3); }
public void SetUp() { FubuMode.SetUpForDevelopmentMode(); runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap(); runtime.Factory.Get <FubuDiagnosticsEndpoint>().get__fubu(); }
public MonitoredNodeGroup() { _port = PortFinder.FindPort(5500); AlterSettings <KatanaSettings>(_ => { _.AutoHostingEnabled = true; _.Port = _port; }); Services(_ => { _.ReplaceService <ISchedulePersistence, RavenDbSchedulePersistence>(); _.ReplaceService <ISubscriptionPersistence, RavenDbSubscriptionPersistence>(); }); ReplaceSettings(RavenDbSettings.InMemory()); Import <MonitoredTransportRegistry>(); container = new Container(_ => { _.ForSingletonOf <MonitoredNodeGroup>().Use(this); }); _runtime = FubuApplication.For(this).StructureMap(container).Bootstrap(); _runtime.Factory.Get <ChannelGraph>().Name = "Monitoring"; _subscriptions = _runtime.Factory.Get <ISubscriptionPersistence>(); _schedules = _runtime.Factory.Get <ISchedulePersistence>(); _store = _runtime.Factory.Get <IDocumentStore>(); }
public void chain_is_on_the_endpoint() { var runtime = FubuApplication.For <SomeRegistry>().StructureMap(new Container()).Bootstrap(); var endpoint = runtime.Factory.Get <IEndpointService>().EndpointFor <SomeEndpoint>(x => x.get_hello()); endpoint.Chain.Calls.Single().HandlerType.ShouldEqual(typeof(SomeEndpoint)); }
public void SetUp() { theContainer = new Container(); theContainer.Configure(x => { x.For <IHttpWriter>().Use(new NulloHttpWriter()); x.For <ICurrentHttpRequest>().Use(new StubCurrentHttpRequest { TheApplicationRoot = "http://server" }); x.For <IStreamingData>().Use(MockRepository.GenerateMock <IStreamingData>()); x.For <ICurrentChain>().Use(new CurrentChain(null, null)); }); theRoutes = FubuApplication.For(() => new FubuRegistry(x => { x.Actions.IncludeType <DiagnosticController>(); x.IncludeDiagnostics(true); })) .StructureMap(() => theContainer) .Bootstrap().Routes; theContainer.Configure(x => x.For <HttpContextBase>().Use(new FakeHttpContext())); }
public void SetUp() { registry = new FubuRegistry(x => { x.Route("area/sub/{Name}/{Age}") .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson(); x.Route("area/sub2/prop") .Calls <TestController>(c => c.SomeAction(null)).OutputToJson(); x.Route("area/sub2/{Name}/{Age}") .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson(); x.Route("area/sub2/{Name}") .Calls <TestController>(c => c.ThirdAction(null)).OutputToJson(); x.Route("area/sub3/{Name}/{Age}") .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson(); x.Route("area/sub4/some_pattern") .Calls <TestController>(c => c.AnotherAction(null)).OutputToJson(); }); container = new Container(); routes = FubuApplication.For(registry).StructureMap(container).Bootstrap().Where(r => !r.As <Route>().Url.StartsWith("_content")).ToList(); container.Configure(x => x.For <IOutputWriter>().Use(new InMemoryOutputWriter())); Debug.WriteLine(container.WhatDoIHave()); }
private EmbeddedFubuMvcServer serverFor(Action <OwinSettings> action) { var registry = new FubuRegistry(); registry.AlterSettings(action); return(FubuApplication.For(registry).StructureMap().RunEmbedded(port: 0)); }
public void invoking_a_chain_will_execute_completely_with_cascading_immediate_continuations() { FubuTransport.SetupForInMemoryTesting(); using (var runtime = FubuApplication.BootstrapApplication <ChainInvokerApplication>()) { var recorder = runtime.Factory.Get <MessageRecorder>(); var invoker = runtime.Factory.Get <IChainInvoker>(); MessageHistory.WaitForWorkToFinish(() => { invoker.InvokeNow(new TriggerImmediate { Text = "First", ContinueText = "I'm good" }); }); recorder.Messages.Each(x => Debug.WriteLine(x)); // Should process all the cascading messages that bubble up // and their cascaded messages recorder.Messages.ShouldContain("First"); recorder.Messages.ShouldContain("I'm good"); recorder.Messages.ShouldContain("I'm good-2"); recorder.Messages.ShouldContain("I'm good-2-4"); recorder.Messages.ShouldContain("I'm good-2-3"); recorder.Messages.ShouldContain("Traced: I'm good"); } }
public void raven_is_available_out_of_the_box() { var container = new Container(); var application = FubuApplication.DefaultPolicies().StructureMap(container).Bootstrap(); container.GetInstance <IDocumentStore>().ShouldNotBeNull(); }
public void can_use_the_default_policies() { var application = FubuApplication.DefaultPolicies().StructureMap(new Container()).Bootstrap(); var graph = application.Factory.Get <BehaviorGraph>(); graph.BehaviorFor <TargetEndpoint>(x => x.get_hello()).ShouldNotBeNull(); }
public FubuApplication BuildApplication() { var container = new Container(x => { x.ForSingletonOf <INumberCache>().Use <NumberCache>(); }); return(FubuApplication.For <FubuHarnessRegistry>().StructureMap(container)); //return FubuTransport.For<HarnessRegistry>().StructureMap(container); }
public static IContainerFacilityExpression For(FubuTransportRegistry extension) { var registry = new FubuRegistry(); extension.As <IFubuRegistryExtension>().Configure(registry); return(FubuApplication.For(registry)); }
public void SetUp() { registry = new FubuRegistry(x => { x.Actions.IncludeType <TestController>(); }); container = new Container(x => { x.For <ICurrentChain>().Use(new CurrentChain(null, null)); x.For <IHttpRequest>().Use(OwinHttpRequest.ForTesting()); }); FubuMvcPackageFacility.PhysicalRootPath = AppDomain.CurrentDomain.BaseDirectory; routes = FubuApplication.For(registry) .StructureMap(container) .Bootstrap() .Routes .Where(r => !r.As <Route>().Url.StartsWith("_content")) .ToList(); container.Configure(x => x.For <IOutputWriter>().Use(new InMemoryOutputWriter())); }
public void FixtureSetUp() { _host = FubuApplication .For <JsonSerializationFubuRegistry>() .StructureMap() .RunInMemory(); }
public static void Scenario <T>(Action <Scenario> configuration) where T : FubuRegistry, new() { using (var host = FubuApplication.For <T>().StructureMap().RunInMemory()) { host.Scenario(configuration); } }
protected void Application_Start(object sender, EventArgs e) { FubuApplication .For <AspNetApplicationFubuRegistry>() .StructureMapObjectFactory() .Bootstrap(); }
public void register_with_basic_authentication_disabled() { var registry = new FubuRegistry(); registry.Import <Saml2Extensions>(); registry.Import <ApplyAuthentication>(); var samlCertificateRepository = MockRepository.GenerateMock <ISamlCertificateRepository>(); samlCertificateRepository.Stub(x => x.AllKnownCertificates()).Return(new SamlCertificate[0]); registry.Services(x => { x.SetServiceIfNone <IPrincipalBuilder>(MockRepository.GenerateMock <IPrincipalBuilder>()); x.AddService <ISamlResponseHandler>(MockRepository.GenerateMock <ISamlResponseHandler>()); x.SetServiceIfNone <ISamlCertificateRepository>(samlCertificateRepository); }); registry.AlterSettings <AuthenticationSettings>(x => { x.MembershipEnabled = MembershipStatus.Disabled; }); var container = new Container(); var runtime = FubuApplication.For(registry).StructureMap(container).Bootstrap(); var strategies = container.GetAllInstances <IAuthenticationStrategy>(); strategies.Single().ShouldBeOfType <SamlAuthenticationStrategy>(); }
public void can_swap_out_the_javascript_route_data() { var container = new Container(_ => { _.For <IJavascriptRouteData>().Use <FakeJavascriptRouteData>(); }); using (var host = FubuApplication.DefaultPolicies().StructureMap(container).RunInMemory()) { host.Scenario(x => { x.Get.Action <JavascriptRoutesEndpoint>(e => e.get_js_router()); x.ContentShouldContain("myRoutes = {"); x.ContentShouldContain("\"m1\":{\"name\":\"m1\",\"method\":\"GET\",\"url\":\"/fake/js/method1/{Name}\""); x.ContentShouldContain("\"m2\":{\"name\":\"m2\",\"method\":\"GET\",\"url\":\"/fake/js/method2\"}"); x.ContentShouldContain("\"m3\":{\"name\":\"m3\",\"method\":\"POST\",\"url\":\"/fake/js/method3\"}"); x.StatusCodeShouldBe(HttpStatusCode.OK); }); } }
public void try_to_create_ISystemTime() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { runtime.Factory.Get <ISystemTime>().ShouldBeOfType <SystemTime>(); } }
public FubuApplication BuildApplication() { return(FubuApplication .For <FubuTestApplicationRegistry>() .StructureMap(new Container()) .Packages(x => x.Assembly(typeof(TestPackage1.JsonSerializedMessage).Assembly))); }
public void invoking_a_chain_will_execute_with_failure_does_not_send_off_cascading_messages() { FubuTransport.SetupForInMemoryTesting(); using (var runtime = FubuApplication.BootstrapApplication <ChainInvokerApplication>()) { var recorder = runtime.Factory.Get <MessageRecorder>(); var invoker = runtime.Factory.Get <IChainInvoker>(); MessageHistory.WaitForWorkToFinish(() => { // The handler for WebMessage is rigged to throw exceptions // if it contains the text 'Bad' invoker.InvokeNow(new WebMessage { Text = "Bad message" }); }); recorder.Messages.Each(x => Debug.WriteLine(x)); // NO MESSAGES SHOULD GET OUT WITH THE ORIGINAL 'Bad Message' recorder.Messages.Any(x => x.Contains("Bad message")).ShouldBeFalse(); AssertCascadedMessages(recorder); } }
public void posts_are_committed() { var container = new Container(new RavenDbRegistry()); container.Inject(new RavenDbSettings { RunInMemory = true }); using (var application = FubuApplication.For <NamedEntityRegistry>().StructureMap(container).RunEmbedded()) { application.Endpoints.PostJson(new NamedEntity { Name = "Jeremy" }).StatusCode.ShouldEqual(HttpStatusCode.OK); application.Endpoints.PostJson(new NamedEntity { Name = "Josh" }).StatusCode.ShouldEqual(HttpStatusCode.OK); application.Endpoints.PostJson(new NamedEntity { Name = "Vyrak" }).StatusCode.ShouldEqual(HttpStatusCode.OK); application.Services.GetInstance <ITransaction>().Execute <IDocumentSession>(session => { session.Query <NamedEntity>() .Customize(x => x.WaitForNonStaleResults()) .Each(x => Debug.WriteLine(x.Name)); }); application.Endpoints.Get <FakeEntityEndpoint>(x => x.get_names()).ReadAsJson <NamesResponse>() .Names.ShouldHaveTheSameElementsAs("Jeremy", "Josh", "Vyrak"); } }
protected void Application_Start(object sender, EventArgs e) { _runtime = FubuApplication .DefaultPolicies() // Use the default FubuMVC conventions .StructureMap() // Use a new StructureMap container .Bootstrap(); }