public static void Run(Action <EndpointDriver> action) { using (var server = EmbeddedFubuMvcServer.For <HarnessApplication>()) { action(server.Endpoints); } }
public static void Start() { FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory(); int port = PortFinder.FindPort(5501); _server = EmbeddedFubuMvcServer.For <HarnessApplication>(GetRootDirectory(), port); }
public static void WithSpecialPort() { // SAMPLE: katana-with-explicit-port using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>(port: 6000)) { } // ENDSAMPLE }
public static void WithSpecialPath() { // SAMPLE: katana-with-explicit-path using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>(physicalPath: "../../../SimpleApplication")) { } // ENDSAMPLE }
public void hit_the_home_page() { using (var server = EmbeddedFubuMvcServer.For <MyApplication>()) { server.Endpoints.Get <HomeEndpoint>(x => x.Index()).ReadAsText() .ShouldEqual("Hello, you've just built your first FubuMVC application"); } }
// The FubuMVC team recommends that you use an IApplicationSource // to contain your bootstrapping code public static void WithApplicationSource() { using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>()) { var greeting = server.Endpoints.Get <HelloEndpoint>(x => x.get_greeting()); Console.WriteLine(greeting); } }
public void no_longer_puts_localhost_in_the_resolved_url() { using (var server = EmbeddedFubuMvcServer.For <HarnessApplication>()) { server.Endpoints.Get <UrlEndpoints>(x => x.get_green()) .ReadAsText().ShouldEqual("/green"); } }
public void the_scheduled_job_visualization_can_be_shown() { using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath)) { server.Endpoints.Get <ScheduledJobsFubuDiagnostics>(x => x.get_scheduled_jobs()) .StatusCode.ShouldEqual(HttpStatusCode.OK); } InMemoryQueueManager.ClearAll(); }
public void the_lightning_queues_summary_page_can_be_shown() { // If this test fails on you, try a quick "git clean -xfd" to get rid of the old fubu-content folders, // then rake compile to regenerate the bottle content using (var server = EmbeddedFubuMvcServer.For <LightningQueuesDiagnosticsApplication>()) { server.Endpoints.Get <LightningQueuesFubuDiagnostics>(x => x.get_queue__managers()) .StatusCode.ShouldEqual(HttpStatusCode.OK); } }
public void with_Katana_and_EndpointDriver() { using (var server = EmbeddedFubuMvcServer .For <SampleApplication>(port: 5700)) { server.Endpoints.Get("conneg/override/Foo?format=json", acceptType: "text/html") .ContentTypeShouldBe(MimeType.Json) .ReadAsJson <OverriddenResponse>() .Name.ShouldEqual("Foo"); } }
public void the_subscriptions_visualization_can_be_shown() { using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath)) { var httpResponse = server.Endpoints.Get <SubscriptionsFubuDiagnostics>(x => x.get_subscriptions()); if (httpResponse.StatusCode != HttpStatusCode.OK) { Assert.Fail(httpResponse.ReadAsText()); } } InMemoryQueueManager.ClearAll(); }
public static void InsideTesting() { // SAMPLE: katana-and-testing using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>()) { // Access to the IServiceFactory for the running application var resolver = server.Services.Get <IObjectResolver>(); // Access to the EndpointDriver for the running application server.Endpoints.Get <HelloEndpoint>(x => x.get_greeting()) .StatusCode.ShouldEqual(HttpStatusCode.OK); // Access to the IUrlRegistry for the running application // to resolve Url's var url = server.Urls.UrlFor <HelloEndpoint>(x => x.get_greeting()); // Access the FubuRuntime for this application, // including information about the route table that // this application is using var routes = server.Runtime.Routes; } // ENDSAMPLE }