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 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 void listens_and_finishes_after_receiving_the_all_clear() { // trying to get the asset pipeline to shut up about // non-existent assets var settings = new ApplicationSettings { PhysicalPath = Environment.CurrentDirectory .ParentDirectory().ParentDirectory().ParentDirectory() .AppendPath("RemoteService") }; var system = new FubuMvcSystem(settings, () => FubuApplication.DefaultPolicies().StructureMap().Bootstrap()); system.AddRemoteSubSystem("Remote", x => { x.UseParallelServiceDirectory("RemoteService"); }); using (var context = system.CreateContext()) { system.StartListeningForMessages(); var message = new RemoteGo(); MessageHistory.Record(MessageTrack.ForSent(message)); var waitForWorkToFinish = MessageHistory.WaitForWorkToFinish(() => { system.RemoteSubSystemFor("Remote").Runner.SendRemotely(message); }, timeoutMilliseconds: 30000); waitForWorkToFinish.ShouldBeTrue(); } }
public void SetUp() { FubuMode.SetUpForDevelopmentMode(); runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap(); runtime.Factory.Get <FubuDiagnosticsEndpoint>().get__fubu(); }
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 try_to_create_ISystemTime() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { runtime.Factory.Get <ISystemTime>().ShouldBeOfType <SystemTime>(); } }
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 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) { _runtime = FubuApplication .DefaultPolicies() // Use the default FubuMVC conventions .StructureMap() // Use a new StructureMap container .Bootstrap(); }
public void build_a_full_application() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { runtime.Factory.Get <IJsonWriter>().ShouldNotBeNull(); } }
public void get_304_on_if_modified_since_pass() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { server.Endpoints.Get("Sample.js", ifModifiedSince: file.LastModified().ToUniversalTime().AddMinutes(10)) .StatusCodeShouldBe(HttpStatusCode.NotModified); } }
public void FubuContinuation_Redirect_honors_the_explicit_METHOD() { using (var server = FubuApplication.DefaultPolicies().StructureMap(new Container()).RunEmbedded(port: 5510)) { server.Endpoints.Get <RedirectedEndpoint>(x => x.get_redirect_explicit()) .ReadAsText().ShouldNotEqual("Right!"); } }
public void runtime_is_in_the_container_and_does_not_cause_a_stackoverflow_when_it_disposes() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { runtime.Factory.Get <FubuRuntime>() .ShouldBeTheSameAs(runtime); } }
public void can_render_a_simple_html_document_that_is_attached_via_view_conventions() { using (var server = FubuApplication.DefaultPolicies().StructureMap(new Container()).RunEmbedded()) { server.Endpoints.Get <DocEndpoint>(x => x.get_document()) .ReadAsText().ShouldContain("<h1>Name = Shiner</h1>"); } }
public static void Inline() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded()) { var greeting = server.Endpoints.Get <HelloEndpoint>(x => x.get_greeting()); Console.WriteLine(greeting); } }
public void see_what_it_looks_like() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { } PackageRegistry.Diagnostics.Timer.DisplayTimings(); }
public void the_FubuContinuation_Redirect_uses_GET_by_default() { using (var server = FubuApplication.DefaultPolicies().StructureMap(new Container()).RunEmbedded(port: 5510)) { server.Endpoints.Get <RedirectedEndpoint>(x => x.get_redirect()) .ReadAsText().ShouldEqual("Right!"); } }
public void read_file_with_hit_on_etag() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { server.Endpoints.Get("Sample.js", etag: file.Etag()) .StatusCodeShouldBe(HttpStatusCode.NotModified); } }
public void can_get_The_about_page_smoke_test() { using (var server = FubuApplication.DefaultPolicies().StructureMap(new Container()).RunEmbedded(port: PortFinder.FindPort(5500))) { var description = server.Endpoints.Get <AboutEndpoint>(x => x.get__about()).ReadAsText(); description.ShouldContain("Assemblies"); Debug.WriteLine(description); } }
public void can_run_a_request_end_to_end() { using (var server = FubuApplication.DefaultPolicies().Windsor().RunEmbedded()) { server.Endpoints.Get <WindsorEndpoint>(x => x.get_windsor()) .ReadAsText() .ShouldEqual("I'm running with Windsor"); } }
public void can_run_an_endpoint_from_end_to_end() { using (var server = FubuApplication.DefaultPolicies().Autofac().RunEmbedded(port: PortFinder.FindPort(5500))) { server.Endpoints.Get <AutofacEndpoint>(x => x.get_autofac()) .ReadAsText() .ShouldEqual("I'm running on Autofac"); } }
public void get_the_file_on_if_modified_since_and_has_been_modified() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { server.Endpoints.Get("Sample.js", ifModifiedSince: file.LastModified().ToUniversalTime().AddMinutes(-20)) .StatusCodeShouldBe(HttpStatusCode.OK) .ReadAsText().ShouldContain("This is some sample data in a static file"); } }
public void can_return_the_text_of_a_txt_file_on_etag_miss() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { var response = server.Endpoints.Get("Sample.js", etag: file.Etag() + "!!!"); response.StatusCodeShouldBe(HttpStatusCode.OK); response.ReadAsText().ShouldContain("This is some sample data in a static file"); } }
public FubuApplication BuildApplication() { return(FubuApplication .DefaultPolicies() .StructureMap() .Packages(x => { x.Loader(new CustomPackageLoader()); x.Activator(new SpecialStartupActivator()); })); }
public void SetUp() { _runner.RunBottles("init src/TestPackage1 pak1"); _runner.RunBottles("link src/FubuMVC.Core.Assets.IntegrationTesting pak1"); _server = FubuApplication.DefaultPolicies() .StructureMap(new Container()) .RunEmbedded(port: PortFinder.FindPort(5505)); }
public void can_return_the_HEAD_for_a_file() { using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { server.Endpoints.Head("Sample.js") .StatusCodeShouldBe(HttpStatusCode.OK) .LastModifiedShouldBe(file.LastModified()) .EtagShouldBe(file.Etag()); } }
public void has_all_the_namespaces_for_the_input_and_output_models() { using (var runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap()) { var namespaces = runtime.Factory.Get <CommonViewNamespaces>(); namespaces.Namespaces.ShouldContain("Red.Testing"); namespaces.Namespaces.ShouldContain("Green.Testing"); namespaces.Namespaces.ShouldContain("Blue.Testing"); } }
public static void Inline() { // You don't have to use a custom IApplicationSource if you // do not want to. // RunEmbedded() is an extension method in FubuMVC.Katana using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded()) { var greeting = server.Endpoints.Get <HelloEndpoint>(x => x.get_greeting()); Console.WriteLine(greeting); } }
public void raven_is_available_out_of_the_box() { NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); var container = new Container(); using (var application = FubuApplication.DefaultPolicies().StructureMap(container).Bootstrap()) { container.GetInstance <IDocumentStore>().ShouldNotBeNull(); } }
public void the_mode_is_passed_in() { FubuMode.Mode("ReallyRandom"); FubuMode.Mode().ShouldEqual("ReallyRandom"); using (var server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(autoFindPort: true)) { server.Endpoints.Get <OwinAppModeEndpoint>(x => x.get_owin_mode()) .ReadAsText() .ShouldEqual("reallyrandom"); } }