예제 #1
0
        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_Pipeline_With_Global_Inbox()
        {
            //act
            _chainOfResponsibility = _chainBuilder.BuildAsync(_requestContext, false);

            //assert
            var tracer = TracePipeline(_chainOfResponsibility.First());

            tracer.ToString().Should().Contain("UseInboxHandlerAsync");
        }