public async Task Then_Expected_Results_Are_Returned(long aoUkprn, long uln, bool isActiveAssessment, bool expectedResponse) { await WhenAsync(aoUkprn, uln, isActiveAssessment); if (_result == null) { expectedResponse.Should().BeFalse(); return; } TqPathwayAssessment expectedAssessment = null; if (isActiveAssessment) { expectedAssessment = _pathwayAssessments.FirstOrDefault(pa => pa.IsOptedin && pa.EndDate == null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln); } else { expectedAssessment = _pathwayAssessments.FirstOrDefault(pa => !pa.IsOptedin && pa.EndDate != null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln); } expectedAssessment.Should().NotBeNull(); var expectedAssessmentDetails = new AssessmentEntryDetails { ProfileId = expectedAssessment.TqRegistrationPathway.TqRegistrationProfileId, AssessmentId = expectedAssessment.Id, AssessmentSeriesName = expectedAssessment.AssessmentSeries.Name }; // Assert _result.ProfileId.Should().Be(expectedAssessmentDetails.ProfileId); _result.AssessmentId.Should().Be(expectedAssessmentDetails.AssessmentId); _result.AssessmentSeriesName.Should().Be(expectedAssessmentDetails.AssessmentSeriesName); }
public override void Given() { expectedApiResult = new AssessmentEntryDetails { ProfileId = 1, AssessmentId = 5, AssessmentSeriesName = "Summer 2021" }; InternalApiClient.GetActiveAssessmentEntryDetailsAsync(AoUkprn, ProfileId, componentType).Returns(expectedApiResult); }
public override void Setup() { _tokenServiceClient = Substitute.For <ITokenServiceClient>(); _configuration = new ResultsAndCertificationConfiguration { ResultsAndCertificationInternalApiSettings = new ResultsAndCertificationInternalApiSettings { Uri = "http://tlevel.api.com" } }; _mockHttpResult = new AssessmentEntryDetails { ProfileId = 1, AssessmentId = _assessmentId, AssessmentSeriesName = "Summer 2021" }; }
public async Task WhenAsync(long aoUkprn, long uln, bool isActiveAssessment) { if (_result != null) { return; } TqPathwayAssessment pathwayAssessment = null; if (isActiveAssessment) { pathwayAssessment = _pathwayAssessments.FirstOrDefault(pa => pa.IsOptedin && pa.EndDate == null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln); } else { pathwayAssessment = _pathwayAssessments.FirstOrDefault(pa => !pa.IsOptedin && pa.EndDate != null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln); } var assessmentId = pathwayAssessment != null ? pathwayAssessment.Id : 0; _result = await AssessmentService.GetActivePathwayAssessmentEntryDetailsAsync(aoUkprn, assessmentId); }
public async override Task When() { _result = await _apiClient.GetActiveAssessmentEntryDetailsAsync(_ukprn, _assessmentId, componentType); }