public async Task Returns_ok_when_person_exist() { var personId = Guid.NewGuid(); _handler .Get(Arg.Is <GetPersonRequest>(request => request.PersonId.Equals(personId))) .Returns(GetPersonResponse.Success(new PersonModel(personId, "any name", DateTime.UtcNow))); var result = await _controller.Get(personId); (result is OkObjectResult).ShouldBeTrue(); }
public async Task <IActionResult> Get(Guid id) { var response = await _handler.Get(new GetPersonRequest(id)); if (response.ResponseType == ResponseType.NotFound) { return(NotFound(response.Message)); } var viewModel = new GetPersonsViewModel(response.PersonModel.Id, response.PersonModel.Name, response.PersonModel.DateCreated); return(Ok(viewModel)); }