public async Task <ActionResult> DeleteRedBetUser([FromRoute] Guid id, [FromBody] DeleteRedBetUser request) { request.Id = id; await _mediator.Send(request); return(NoContent()); }
public void ShouldRequireId() { var command = new DeleteRedBetUser(); FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>() .Where(ex => ex.Errors.Any(e => e.ErrorMessage.Equals("Id is required"))); }
public void ShouldThrowUserNotFoundExceptionGivenNoUser() { var id = Guid.NewGuid(); var command = new DeleteRedBetUser { Id = id }; SetRedBetRepositoryGetResult(id, null); FluentActions.Invoking(() => SendAsync(command)).Should().Throw <UserNotFoundException>(); }
public async Task ShouldCallDeleteMethodOnRepository() { var id = Guid.NewGuid(); var command = new DeleteRedBetUser { Id = id }; SetRedBetRepositoryGetResult(id, new RedBetUser(id, new BasicUserInformation("Test", "Test", new Address("Street", 10, "32-091")), "Test")); await SendAsync(command); MockRedBetRepository.Verify(repository => repository.DeleteAsync(id), Times.Once); }