public async Task GetPhoneBookByIdMustSuccess(GetPhoneBook query, PhoneBookViewModel expected) { _dispatcher.QueryAsync(query).Returns(Task.FromResult(expected)); var result = await _controller.Get(query); var okResult = Assert.IsType <OkObjectResult>(result); Assert.NotNull(okResult.Value); Assert.Equal(expected, okResult.Value); }
public async Task <IActionResult> Get([FromQuery] GetPhoneBook query) { var entity = await _dispatcher.QueryAsync(query); return(Ok(entity)); }