public void When_A_Handler_Is_Part_Of_An_Async_Pipeline() { _pipeline = _pipelineBuilder.BuildAsync(new RequestContext(), false).First(); TracePipeline().ToString().Should().Contain("MyImplicitHandlerAsync"); TracePipeline().ToString().Should().Contain("MyLoggingHandlerAsync"); }
public async Task When_Building_A_Pipeline_With_Global_Inbox() { // Settings for UseInbox on MyCommandInboxedHandler // [UseInbox(step:0, contextKey: typeof(MyCommandInboxedHandler), onceOnly: false)] // Settings for InboxConfifguration as above // _inboxConfiguration = new InboxConfiguration(InboxScope.All, context: true, onceOnly: true); // so global will not allow repeated requests ans calls, but local should override this and allow //act _chainOfResponsibility = _chainBuilder.BuildAsync(_requestContext, false); var chain = _chainOfResponsibility.First(); var myCommand = new MyCommand(); //First pass not impacted by UseInbox Handler await chain.HandleAsync(myCommand); bool noException = true; try { await chain.HandleAsync(myCommand); } catch (OnceOnlyException) { noException = false; } //assert noException.Should().BeTrue(); }
public void When_Building_A_Handler_For_An_Async_Command() { s_chainOfResponsibility = s_chainBuilder.BuildAsync(s_requestContext, false).First(); Assert.NotNull(s_chainOfResponsibility.Context); Assert.AreSame(s_requestContext, s_chainOfResponsibility.Context); }
public void When_Building_A_Handler_For_An_Async_Command() { _chainOfResponsibility = _chainBuilder.BuildAsync(_requestContext, false).First(); _chainOfResponsibility.Context.Should().NotBeNull(); _chainOfResponsibility.Context.Should().BeSameAs(_requestContext); }
public void When_Building_An_Async_Pipeline_That_Has_Sync_Handlers() { _exception = Catch.Exception(() => _pipeline = _pipelineBuilder.BuildAsync(new RequestContext(), false).First()); Assert.NotNull(_exception); Assert.IsInstanceOf(typeof(ConfigurationException), _exception); StringAssert.Contains(typeof(MyLoggingHandler <>).Name, _exception.Message); }
public void When_Building_An_Async_Pipeline_That_Has_Sync_Handlers() { _exception = Catch.Exception(() => _pipeline = _pipelineBuilder.BuildAsync(new RequestContext(), false).First()); _exception.Should().NotBeNull(); _exception.Should().BeOfType <ConfigurationException>(); _exception.Message.Should().Contain(typeof(MyLoggingHandler <>).Name); }
public void When_Building_A_Pipeline_Failures_Should_Be_ConfigurationErrors() { var exception = Catch.Exception(() => _chainBuilder.BuildAsync(_requestContext, false)); exception.Should().NotBeNull(); exception.Should().BeOfType <ConfigurationException>(); exception.InnerException.Should().BeOfType <InvalidOperationException>(); }
public void When_Building_A_Pipeline_With_Global_Inbox() { //act _chainOfResponsibility = _chainBuilder.BuildAsync(_requestContext, false); //assert var tracer = TracePipeline(_chainOfResponsibility.First()); tracer.ToString().Should().Contain("UseInboxHandlerAsync"); }
public void When_Building_An_Async_Pipeline_Preserve_The_Order() { _pipeline = _pipeline_Builder.BuildAsync(new RequestContext(), false).First(); PipelineTracer().ToString().Should().Be("MyLoggingHandlerAsync`1|MyValidationHandlerAsync`1|MyDoubleDecoratedHandlerAsync|"); }
private void When_Building_An_Async_Pipeline_Allow_Pre_And_Post_Tasks() { _pipeline = _pipelineBuilder.BuildAsync(new RequestContext(), false).First(); TraceFilters().ToString().Should().Be("MyValidationHandlerAsync`1|MyPreAndPostDecoratedHandlerAsync|MyLoggingHandlerAsync`1|"); }
public void When_Building_An_Async_Pipeline_Allow_ForiegnAttribues() { _pipeline = _pipeline_Builder.BuildAsync(new RequestContext(), false).First(); Assert.AreEqual("MyValidationHandlerAsync`1|MyObsoleteCommandHandlerAsync|MyLoggingHandlerAsync`1|", TraceFilters().ToString()); }
public void When_Building_An_Async_Pipeline_Allow_ForeignAttributes() { _pipeline = _pipeline_Builder.BuildAsync(new RequestContext(), false).First(); TraceFilters().ToString().Should().Be("MyValidationHandlerAsync`1|MyObsoleteCommandHandlerAsync|MyLoggingHandlerAsync`1|"); }