public async Task <GetResultsResponse> GetResults() { var sessionId = await sessionService.GetSessionId().ConfigureAwait(false); var results = await resultsApiService.GetResults(sessionId, AssessmentTypeName.ShortAssessment).ConfigureAwait(false); return(AddInCategoryJobProfileCount(results)); }
public async Task GetResultsReturnsValidDataForSuccess() { var sessionId = "session1"; var jobCategory = "short"; httpMessageHandler.When($"{httpClient.BaseAddress}/result/{sessionId}/{jobCategory}") .Respond("application/json", "{'sessionId':'session1'}"); var resultsResponse = await resultsApiService.GetResults(sessionId, jobCategory); Assert.Equal(sessionId, resultsResponse.SessionId); }
public async Task GetResults() { //Arrange var category = "ACategory"; var resultsResponse = new GetResultsResponse() { SessionId = sessionId }; List <JobProfileResult> profiles = new List <JobProfileResult> { new JobProfileResult() { UrlName = category, JobCategory = category } }; resultsResponse.JobProfiles = profiles; List <JobCategoryResult> categories = new List <JobCategoryResult> { new JobCategoryResult() { JobFamilyName = category, JobFamilyUrl = category } }; resultsResponse.JobCategories = categories; A.CallTo(() => resultsApiService.GetResults(sessionId, A <string> .Ignored)).Returns(resultsResponse); //Act var results = await resultsService.GetResults(); //Assert A.CallTo(() => resultsApiService.GetResults(sessionId, A <string> .Ignored)).MustHaveHappenedOnceExactly(); results.SessionId.Should().Be(sessionId); results.JobCategories.FirstOrDefault().NumberOfMatchedJobProfile.Should().Be(1); }