public void PatchGroupAsync_ShouldReturnExpectedHttpStatusCodeOnKnownErrors(Exception exception, int expectedStatusCode) { const int groupId = 8; var request = new PatchGroupRequest(); _groupService.EditGroupPropertiesAsync(_executionContext, groupId, request) .Returns(Task.FromException <List <Loot> >(exception)); Func <Task> act = () => _controller.PatchGroupAsync(_executionContext, groupId, request); act.Should().Throw <HttpErrorException>().Which.StatusCode.Should().Be(expectedStatusCode); }