public async Task GetAllListReturnsSuccess() { // arrange var expectedResults = A.CollectionOfFake <JobProfileSkillSegmentModel>(2); A.CallTo(() => repository.GetAllAsync()).Returns(expectedResults); // act var results = await skillSegmentService.GetAllAsync().ConfigureAwait(false); // assert A.CallTo(() => repository.GetAllAsync()).MustHaveHappenedOnceExactly(); Assert.Equal(expectedResults, results); }
public async Task <IActionResult> Index() { logService.LogInformation($"{IndexActionName} has been called"); var viewModel = new IndexViewModel(); var segmentModels = await skillSegmentService.GetAllAsync().ConfigureAwait(false); if (segmentModels != null) { viewModel.Documents = segmentModels .OrderBy(x => x.CanonicalName) .Select(x => mapper.Map <IndexDocumentViewModel>(x)) .ToList(); logService.LogInformation($"{IndexActionName} has succeeded"); } else { logService.LogWarning($"{IndexActionName} has returned with no results"); } return(View(viewModel)); }