public void ShouldRequireValidTodoListId() { var command = new DeleteTodoListCommand { Id = 99 }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <NotFoundException>(); }
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."); }
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))); }