コード例 #1
0
        public async Task Should_throw_exception_if_app_not_found()
        {
            appContext.App = null;

            var command = new CreateContent();
            var context = Ctx(command);

            await Assert.ThrowsAsync <InvalidOperationException>(() => sut.HandleAsync(context));
        }
コード例 #2
0
        public async Task Should_throw_exception_if_app_not_found()
        {
            A.CallTo(() => contextProvider.Context)
            .Returns(Context.Anonymous(null !));

            var command = new CreateContent();
            var context = Ctx(command);

            await Assert.ThrowsAsync <InvalidOperationException>(() => sut.HandleAsync(context));
        }
コード例 #3
0
        private async Task <CommandContext> HandleAsync(ICommand command)
        {
            var commandContext = new CommandContext(command, A.Fake <ICommandBus>());

            await sut.HandleAsync(commandContext);

            return(commandContext);
        }
コード例 #4
0
        public async Task Should_throw_exception_if_app_not_found()
        {
            httpContext.Features.Set <IAppFeature>(new AppResolver.AppFeature(null));

            var command = new CreateContent();
            var context = new CommandContext(command, commandBus);

            await Assert.ThrowsAsync <InvalidOperationException>(() => sut.HandleAsync(context));
        }