示例#1
0
 public void SetUp()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         registry = runtime.Get <BindingRegistry>();
     }
 }
示例#2
0
 public void smoke()
 {
     using (FubuRuntime.Basic(_ => _.Features.Localization.Enable(true)))
     {
         Debug.WriteLine("Ok, can load localization just fine");
     }
 }
示例#3
0
        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(() => FubuRuntime.Basic());

            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); }, 30000);
                waitForWorkToFinish.ShouldBeTrue();
            }
        }
示例#4
0
        public void can_use_the_default_policies()
        {
            var application = FubuRuntime.Basic();
            var graph       = application.Get <BehaviorGraph>();

            graph.ChainFor <TargetEndpoint>(x => x.get_hello()).ShouldNotBeNull();
        }
示例#5
0
 public void try_to_create_ISystemTime()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         runtime.Get <ISystemTime>().ShouldBeOfType <SystemTime>();
     }
 }
示例#6
0
 public void StartApplication()
 {
     using (var runtime = FubuRuntime.Basic(_ => _.HostWith <NOWIN>()))
     {
         Console.WriteLine("Web application available at " + runtime.BaseAddress);
     }
 }
示例#7
0
 public void IAssetTagBuilder_is_registered_in_development_mode()
 {
     using (var runtime = FubuRuntime.Basic(_ => _.Mode = "development"))
     {
         runtime.Get <IContainer>().DefaultRegistrationIs <IAssetTagBuilder, DevelopmentModeAssetTagBuilder>();
     }
 }
 public void see_what_it_looks_like()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         Debug.WriteLine(runtime.ActivationDiagnostics.Timer.DisplayTimings());
     }
 }
        public void SetUp()
        {
            theParent = new Parent
            {
                Children = new[]
                {
                    new Child {
                        Name = "Jeremy"
                    },
                    new Child {
                        Name = "Jessica"
                    },
                    new Child {
                        Name = "Natalie"
                    }
                }
            };

            var container = new Container();
            var registry  = new FubuRegistry();

            using (var runtime = FubuRuntime.Basic())
            {
                runner = runtime.Get <IProjectionRunner>();
            }
        }
 public void IClock_should_be_a_singleton_just_by_usage_of_the_IsSingleton_property()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         runtime.Get <IContainer>().Model.For <IClock>().Default.Lifecycle.ShouldBeOfType <SingletonLifecycle>();
     }
 }
        public void not_applied_when_no_tracing_tag_is_on_the_chain()
        {
            using (var runtime = FubuRuntime.Basic(_ => _.Mode = "development"))
            {
                var graph = runtime.Get <BehaviorGraph>();

                graph.ChainFor <NotTracedEndpoint>(x => x.get_nothing())
                .OfType <BehaviorTracerNode>()
                .Any()
                .ShouldBeFalse();


                graph.ChainFor <NotTracedEndpoint>(x => x.get_something())
                .OfType <BehaviorTracerNode>()
                .Any()
                .ShouldBeFalse();

                graph.ChainFor <SomeTracingEndpoint>(x => x.get_tracing_no())
                .OfType <BehaviorTracerNode>()
                .Any()
                .ShouldBeFalse();


                graph.ChainFor <SomeTracingEndpoint>(x => x.get_tracing_yes())
                .OfType <BehaviorTracerNode>()
                .Any()
                .ShouldBeTrue();
            }
        }
 public void SetUp()
 {
     server = FubuRuntime.Basic(_ =>
     {
         _.Mode = "development";
         _.HostWith <Katana>();
     });
 }
示例#13
0
 public void no_headers_in_development_mode()
 {
     using (var runtime = FubuRuntime.Basic(_ => _.Mode = "development"))
     {
         runtime.Get <AssetSettings>()
         .Headers.GetAllKeys().Any().ShouldBeFalse();
     }
 }
示例#14
0
 public void do_not_precompile_when_in_development_mode()
 {
     using (var runtime = FubuRuntime.Basic(_ => _.Mode = "development"))
     {
         runtime.Get <SparkEngineSettings>()
         .PrecompileViews.ShouldBeFalse();
     }
 }
 public void level_is_verbose_in_development()
 {
     using (var runtime = FubuRuntime.Basic(_ => _.Mode = "development"))
     {
         runtime.Get <DiagnosticsSettings>()
         .TraceLevel.ShouldBe(TraceLevel.Verbose);
     }
 }
示例#16
0
 public void runtime_is_in_the_container_and_does_not_cause_a_stackoverflow_when_it_disposes()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         runtime.Get <FubuRuntime>()
         .ShouldBeTheSameAs(runtime);
     }
 }
示例#17
0
        public void description_smoke_tester()
        {
            using (var runtime = FubuRuntime.Basic())
            {
                var description = FubuApplicationDescriber.WriteDescription(runtime.ActivationDiagnostics, runtime);

                Console.WriteLine(description);
            }
        }
 public void has_all_the_namespaces_for_the_input_and_output_models()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         var namespaces = runtime.Get <CommonViewNamespaces>();
         namespaces.Namespaces.ShouldContain("Red.Testing");
         namespaces.Namespaces.ShouldContain("Green.Testing");
         namespaces.Namespaces.ShouldContain("Blue.Testing");
     }
 }
示例#19
0
 public void make_it_fail()
 {
     using (var runtime = FubuRuntime.Basic())
     {
         runtime.Scenario(_ =>
         {
             _.Get.Action <ErrorEndpoint>(x => x.get_error2());
         });
     }
 }
示例#20
0
        public void find_assembly_extensions()
        {
            using (var runtime = FubuRuntime.Basic())
            {
                var assembly = typeof(AssemblyPackageMarker).Assembly;

                runtime.Behaviors.PackageAssemblies.ShouldContain(assembly);
            }
            ;
        }
示例#21
0
        private AuthorizationBehavior toBehavior(AuthorizationNode node)
        {
            AuthorizationBehavior behavior = null;

            using (var runtime = FubuRuntime.Basic())
            {
                behavior = (AuthorizationBehavior)runtime.Get <IContainer>().GetInstance <IActionBehavior>(node.As <IContainerModel>().ToInstance());
            }

            return(behavior);
        }
        public void picks_up_all_the_validation_registrations()
        {
            using (var runtime = FubuRuntime.Basic())
            {
                var graph = runtime.Get <ValidationGraph>();

                FakeValidationRegistration.Configured.ShouldBeSameAs(graph);
                FakeValidationRegistration2.Configured.ShouldBeSameAs(graph);
                FakeValidationRegistration3.Configured.ShouldBeSameAs(graph);
            }
        }
示例#23
0
        public void the_restarted_property_is_set()
        {
            var floor   = DateTime.Now.AddSeconds(-5);
            var ceiling = DateTime.Now.AddSeconds(5);


            using (var runtime = FubuRuntime.Basic())
            {
                (floor < runtime.Restarted && runtime.Restarted < ceiling).ShouldBeTrue();
            }
        }
        public void see_the_trace_messages_going_through()
        {
            using (var runtime = FubuRuntime.Basic(_ => _.Features.Diagnostics.Enable(TraceLevel.Production)))
            {
                var id1 = runtime.Scenario(_ =>
                {
                    _.Get.Action <DiagnosticEndpoints>(x => x.get_message1());
                }).RequestId();

                var id2 = runtime.Scenario(_ =>
                {
                    _.Get.Action <DiagnosticEndpoints>(x => x.get_message1());
                }).RequestId();

                var id3 = runtime.Scenario(_ =>
                {
                    _.Get.Action <DiagnosticEndpoints>(x => x.get_message2());
                }).RequestId();

                var id4 = runtime.Scenario(_ =>
                {
                    _.Get.Action <DiagnosticEndpoints>(x => x.get_message2());
                }).RequestId();

                var id5 = runtime.Scenario(_ =>
                {
                    _.Get.Action <DiagnosticEndpoints>(x => x.get_message2());
                }).RequestId();

                var history = runtime.Get <IChainExecutionHistory>();

                var success = Wait.Until(() => history.RecentReports().Count() == 5);
                success.ShouldBeTrue();

                history.Find(Guid.Parse(id1)).ShouldNotBeNull();
                history.Find(Guid.Parse(id2)).ShouldNotBeNull();
                history.Find(Guid.Parse(id3)).ShouldNotBeNull();
                history.Find(Guid.Parse(id4)).ShouldNotBeNull();
                history.Find(Guid.Parse(id5)).ShouldNotBeNull();

                Wait.Until(() =>
                {
                    return(runtime.Behaviors.ChainFor <DiagnosticEndpoints>(x => x.get_message1())
                           .Performance.HitCount == 2);
                }).ShouldBeTrue();

                Wait.Until(() =>
                {
                    return(runtime.Behaviors.ChainFor <DiagnosticEndpoints>(x => x.get_message2())
                           .Performance.HitCount == 3);
                }).ShouldBeTrue();
            }
        }
示例#25
0
        public void raven_is_available_out_of_the_box()
        {
            NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);

            using (var application = FubuRuntime.Basic())
            {
                application.Behaviors.PackageAssemblies.Each(x => Debug.WriteLine(x.GetName().FullName));


                application.Get <IDocumentStore>().ShouldNotBeNull();
            }
        }
示例#26
0
        public void headers_in_production_mode()
        {
            using (var runtime = FubuRuntime.Basic(_ => _.Mode = ""))
            {
                var settings = runtime.Get <AssetSettings>();
                settings.Headers.GetAllKeys()
                .ShouldHaveTheSameElementsAs(HttpGeneralHeaders.CacheControl, HttpGeneralHeaders.Expires);

                settings.Headers[HttpGeneralHeaders.CacheControl]().ShouldBe("private, max-age=86400");
                settings.Headers[HttpGeneralHeaders.Expires]().ShouldNotBeNull();
            }
        }
示例#27
0
 public void explicitly_do_not_precompile_views()
 {
     using (var runtime = FubuRuntime.Basic(_ =>
     {
         _.Mode = "production";
         _.AlterSettings <SparkEngineSettings>(x => x.PrecompileViews = false);
     }))
     {
         runtime.Get <SparkEngineSettings>()
         .PrecompileViews.ShouldBeFalse();
     }
 }
        public void should_build_the_template_just_fine()
        {
            using (var server = FubuRuntime.Basic())
            {
                var response = server.Scenario(_ =>
                {
                    _.Get.Action <IndexerOwnerEndpoint>(x => x.get_template_for_indexer());
                });


                response.Body.ReadAsText()
                .ShouldContain("<input type=\"text\" value=\"\" name=\"Children[-1]\" />");
            }
        }
        public void service_registrations()
        {
            var registry = new FubuRegistry();

            registry.AlterSettings <LightningQueueSettings>(_ => _.DisableIfNoChannels = true);

            using (var runtime = FubuRuntime.Basic())
            {
                var container = runtime.Get <IContainer>();

                container.ShouldHaveRegistration <ITransport, LightningQueuesTransport>();
                container.DefaultRegistrationIs <IPersistentQueues, PersistentQueues>();
            }
        }
        public void use_parallel_folder()
        {
            using (var runtime = FubuRuntime.Basic(_ => _.UseParallelDirectory("AssemblyPackage")))
            {
                runtime.Scenario(_ =>
                {
                    _.Get.Url("/JavaScript1.js");
                    _.StatusCodeShouldBeOk();

                    // There's a file in the AssemblyPackage project called JavaScript1.js
                    // with this line
                    _.ContentShouldContain("var answer = 42;");
                });
            }
        }