Esempio n. 1
0
        public void ShouldRequireValidTodoListId()
        {
            var command = new DeleteTodoListCommand {
                Id = 99
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().Throw <NotFoundException>();
        }
Esempio n. 2
0
        public async void ShouldThrowException_WhenTryingToDeleteListThatDoesNotExist()
        {
            // Arrange
            var command = new DeleteTodoListCommand {
                Id = 99
            };

            // Act
            var exception = await Record.ExceptionAsync(async() =>
            {
                await _fixture.SendAsync(command);
            });

            // Assert
            exception.ShouldBeOfType <NotFoundException>();
            exception.Message.ShouldContain("Entity \"TodoList\" (99) was not found.");
        }
Esempio n. 3
0
        public async Task <HttpResponseData> DeleteTodosList([HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "todolists/{id}")]
                                                             HttpRequestData req,
                                                             int id,
                                                             FunctionContext functionContext)
        {
            logger.LogInformation("Called DeleteTodosList");

            var request = new DeleteTodoListCommand
            {
                Id = id
            };

            return(await this.processor.ExecuteAsync <DeleteTodoListCommand, Unit>(functionContext,
                                                                                   req,
                                                                                   request,
                                                                                   (r) => req.CreateResponseAsync(System.Net.HttpStatusCode.NoContent)));
        }