public async Task <ActionResult> GetAll() { try { return(Ok(await _service.GetAll())); } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public async Task E_Possivel_Executar_GetAll() { _serviceMock = new Mock <ILivroServices>(); _serviceMock.Setup(c => c.GetAll()).ReturnsAsync(ListLivroDto); _service = _serviceMock.Object; var result = await _service.GetAll(); Assert.NotNull(result); var listVazia = new List <LivroDto>(); _serviceMock = new Mock <ILivroServices>(); _serviceMock.Setup(c => c.GetAll()).ReturnsAsync(listVazia); _service = _serviceMock.Object; var resultEmpty = await _service.GetAll(); Assert.Empty(resultEmpty); }