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();
            }
        }
예제 #2
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();
            }
        }
예제 #3
0
        public void modify_the_underlying_container()
        {
            using (var system = new FubuMvcSystem<TargetApplication>())
            {
                system.ModifyContainer(x => x.For<IColor>().Use<Green>());

                system.CreateContext().GetService<IColor>()
                    .ShouldBeOfType<Green>();
            }
        }
예제 #4
0
        public void can_recycle()
        {
            using (var system = new FubuMvcSystem<TargetApplication>())
            {
                using (var context = system.CreateContext())
                {
                    context.GetService<IApplicationUnderTest>().ShouldNotBeNull();
                    system.Recycle();
                    context.GetService<IApplicationUnderTest>().ShouldNotBeNull();
                }

                using (var context = system.CreateContext())
                {
                    context.GetService<IApplicationUnderTest>().ShouldNotBeNull();
                    system.Recycle();
                    context.GetService<IApplicationUnderTest>().ShouldNotBeNull();
                }
            }
        }
예제 #5
0
        public void can_recycle()
        {
            using (var system = new FubuMvcSystem <TargetApplication>())
            {
                using (var context = system.CreateContext())
                {
                    context.GetService <IApplicationUnderTest>().ShouldNotBeNull();
                    system.Recycle();
                    context.GetService <IApplicationUnderTest>().ShouldNotBeNull();
                }

                using (var context = system.CreateContext())
                {
                    context.GetService <IApplicationUnderTest>().ShouldNotBeNull();
                    system.Recycle();
                    context.GetService <IApplicationUnderTest>().ShouldNotBeNull();
                }
            }
        }
예제 #6
0
        public void modify_the_underlying_container()
        {
            using (var system = new FubuMvcSystem <TargetApplication>())
            {
                system.ModifyContainer(x => x.For <IColor>().Use <Green>());

                system.CreateContext().GetService <IColor>()
                .ShouldBeOfType <Green>();
            }
        }
예제 #7
0
        public void registers_the_IRemoveSubsystems_with_the_container()
        {
            //FubuApplication.RootPath = ".".ToFullPath();

            using (var system = new FubuMvcSystem<TargetApplication>())
            {
                using (var context = system.CreateContext())
                {
                    context.GetService<IRemoteSubsystems>()
                        .ShouldBeTheSameAs(system);
                }
            }
        }
예제 #8
0
        public void registers_the_IRemoveSubsystems_with_the_container()
        {
            //FubuApplication.RootPath = ".".ToFullPath();

            using (var system = new FubuMvcSystem <TargetApplication>())
            {
                using (var context = system.CreateContext())
                {
                    context.GetService <IRemoteSubsystems>()
                    .ShouldBeTheSameAs(system);
                }
            }
        }
예제 #9
0
        public void registers_the_IRemoveSubsystems_with_the_container()
        {
            FubuMvcPackageFacility.PhysicalRootPath = ".".ToFullPath();

            using (var system = new FubuMvcSystem <TargetApplication>())
            {
                using (var context = system.CreateContext())
                {
                    context.Services.GetInstance <IRemoteSubsystems>()
                    .ShouldBeTheSameAs(system);
                }
            }
        }
예제 #10
0
        public void works_with_the_contextual_providers()
        {
            using (var system = new FubuMvcSystem <TargetApplication>())
            {
                system.ModifyContainer(x => {
                    x.For <IContextualInfoProvider>().Add(new FakeContextualProvider("red", "green"));
                    x.For <IContextualInfoProvider>().Add(new FakeContextualProvider("blue", "orange"));
                });

                system.CreateContext().As <IResultsExtension>()
                .Tags().Select(x => x.Text())
                .ShouldHaveTheSameElementsAs("red", "green", "blue", "orange");
            }
        }
        public void start_a_test_and_try_to_hit_the_endpoint()
        {
            var context = theSystem.CreateContext();

            var application = context.Services.GetInstance <IApplicationUnderTest>();

            // The below is enough to prove we're making a round trip
            var response = application.Endpoints().PostJson(new NameModel {
                Name = "Jeremy"
            });

            response.StatusCode.ShouldEqual(HttpStatusCode.OK);
            response.ReadAsJson <NameModel>().Name.ShouldEqual("Jeremy");
        }
예제 #12
0
        public void registers_the_IRemoveSubsystems_with_the_container()
        {
            FubuMvcPackageFacility.PhysicalRootPath = ".".ToFullPath();

            using (
                var system = new FubuMvcSystem<TargetApplication>()
                )
            {
                using (var context = system.CreateContext())
                {
                    context.Services.GetInstance<IRemoteSubsystems>()
                        .ShouldBeTheSameAs(system);
                }
            }
        }
예제 #13
0
        public void works_with_the_contextual_providers()
        {
            using (var system = new FubuMvcSystem<TargetApplication>())
            {
                system.ModifyContainer(x => {
                    x.For<IContextualInfoProvider>().Add(new FakeContextualProvider("red", "green"));
                    x.For<IContextualInfoProvider>().Add(new FakeContextualProvider("blue", "orange"));
                });

                system.CreateContext().As<IResultsExtension>()
                    .Tags().Select(x => x.Text())
                    .ShouldHaveTheSameElementsAs("red", "green", "blue", "orange");
            }
        }