public void invoking_a_chain_will_execute_completely_with_cascading_immediate_continuations() { using (var runtime = FubuRuntime.For <ChainInvokerTransportRegistry>()) { var recorder = runtime.Get <MessageRecorder>(); var invoker = runtime.Get <IChainInvoker>(); MessageHistory.WaitForWorkToFinish(() => { invoker.InvokeNow(new TriggerImmediate { Text = "First", ContinueText = "I'm good" }); }); // 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 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 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 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(); } }
public void LoadNode(string Key, [SelectionValues("FubuTransportRegistries")] string Registry, string ReplyUri) { MessageHistory.WaitForWorkToFinish(() => { var node = new RunningNode(Registry, ReplyUri.ToUri()); node.Start(); _nodes[Key] = node; Context.Trace(new CodeTag(Key, node.Contents)); }); }
public void finish_successfully_with_MessageHistory_WaitForWorkToFinish_positive() { var foo1 = new Foo(); var foo2 = new Foo(); var foo3 = new Foo(); MessageHistory.WaitForWorkToFinish(() => { MessageHistory.Record(MessageTrack.ForSent(foo1)); MessageHistory.Record(MessageTrack.ForSent(foo2)); MessageHistory.Record(MessageTrack.ForSent(foo3)); MessageHistory.Record(MessageTrack.ForReceived(foo1)); MessageHistory.Record(MessageTrack.ForReceived(foo2)); MessageHistory.Record(MessageTrack.ForReceived(foo3)); }).ShouldBeTrue(); }
public void invoking_a_chain_will_execute_completely_with_cascading_immediate_continuations_even_if_the_continuation_messages_fail_and_retry_immediately() { using (var runtime = FubuRuntime.For <ChainInvokerTransportRegistry>()) { var recorder = runtime.Get <MessageRecorder>(); var invoker = runtime.Get <IChainInvoker>(); MessageHistory.WaitForWorkToFinish(() => { invoker.InvokeNow(new TriggerImmediate { Text = "First", ContinueText = "Retry message" }); }); // Should process all the cascading messages that bubble up // and their cascaded messages recorder.Messages.ShouldContain("First"); AssertCascadedMessages(recorder); } }
public void invoking_a_chain_will_execute_with_failure_does_not_send_off_cascading_messages() { using (var runtime = FubuRuntime.For <ChainInvokerTransportRegistry>()) { var recorder = runtime.Get <MessageRecorder>(); var invoker = runtime.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" }); }); // NO MESSAGES SHOULD GET OUT WITH THE ORIGINAL 'Bad Message' recorder.Messages.Any(x => x.Contains("Bad message")).ShouldBeFalse(); AssertCascadedMessages(recorder); } }