public async Task E_Possivel_Excutar_Get() { _serviceMock = new Mock <IFilmeServices>(); _serviceMock.Setup(m => m.Get(IdFilmes)).ReturnsAsync(filmesDto); _service = _serviceMock.Object; var result = await _service.Get(IdFilmes); Assert.NotNull(result); Assert.True(result.Id == IdFilmes); Assert.Equal(NomeFilmes, result.Name); var record = await _service.Get(IdFilmes); }
public async Task <ActionResult> Get(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); //400 solicitação invalida } try { return(Ok(await _service.Get(id))); } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }