コード例 #1
0
        public void ShouldThrowValidationException()
        {
            UpdateVermittlerProfilCommand command =
                new UpdateVermittlerProfilCommand();

            Func <Task> act = async() => { await SendAsync(command); };

            act.Should().Throw <ValidationException>()
            .Which.Errors.Count().Should().Be(13);
        }
コード例 #2
0
 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));
     }
 }