public async Task <IActionResult> GetAsync() { IEnumerable <EmployeeDomainModel> models; try { models = await _domain.GetAsync().ConfigureAwait(false); } catch (Exception ex) { return(BadRequest(ex.InnerException)); } return(Ok(models)); }
public async void GetAsync_ReturnAll() { var domainModels = new List <EmployeeDomainModel> { CreateDomain(), CreateDomain(), CreateDomain() }; var models = ToListModel <Employee, EmployeeDomainModel>(domainModels); _repository.Setup(x => x.GetAsync()).ReturnsAsync(models); var result = await _domain.GetAsync().ConfigureAwait(false); result.Should().AllBeOfType <EmployeeDomainModel>(); result.Should().BeEquivalentTo(domainModels); }