public void ShouldThrowValidationException() { UpdateVermittlerProfilCommand command = new UpdateVermittlerProfilCommand(); Func <Task> act = async() => { await SendAsync(command); }; act.Should().Throw <ValidationException>() .Which.Errors.Count().Should().Be(13); }
public async Task <ActionResult <int> > RegisterOrUpdateVermittler( [FromBody] UpdateVermittlerProfilCommand command) { try { return(Ok(await Mediator.Send(command))); } catch (NotFoundException ex) { return(NotFound(ex.Message)); } catch (BadRequestException ex) { return(BadRequest(ex.Message)); } catch (UnauthorizedAccessException) { return(StatusCode(StatusCodes.Status401Unauthorized)); } }