public void Multiple_CourseDataLocks_AreMapped() { //Arrange _dataLocksWithCourseMismatch = new List <DataLock> { new DataLock { IsResolved = false, DataLockStatus = Status.Fail, ErrorCode = DataLockErrorCode.Dlock04, IlrEffectiveFromDate = DateTime.Now.Date.AddDays(7), ApprenticeshipId = 123, IlrTrainingCourseCode = "548" }, new DataLock { IsResolved = false, DataLockStatus = Status.Fail, ErrorCode = DataLockErrorCode.Dlock05, IlrEffectiveFromDate = DateTime.Now.Date.AddDays(7), ApprenticeshipId = 123, IlrTrainingCourseCode = "548" } }; _dataLockSummariesResponse = _fixture.Build <GetDataLockSummariesResponse>() .With(x => x.DataLocksWithCourseMismatch, _dataLocksWithCourseMismatch) .Create(); //Act var dataLockSummary = _dataLockSummariesResponse.MapDataLockSummary(_allTrainingProgrammeResponse); var result = _apprenticeshipResponse.MapCourseDataLock(dataLockSummary.DataLockWithCourseMismatch, _priceEpisodes); //Assert Assert.AreEqual(2, result.Count()); }
public void CourseDataLock_IsMapped() { //Arrange _dataLocksWithCourseMismatch = new List <DataLock> { new DataLock { IsResolved = false, DataLockStatus = Status.Fail, ErrorCode = DataLockErrorCode.Dlock04, IlrEffectiveFromDate = DateTime.Now.Date.AddDays(7), IlrTrainingCourseCode = "548" } }; _dataLockSummariesResponse = _fixture.Build <GetDataLockSummariesResponse>() .With(x => x.DataLocksWithCourseMismatch, _dataLocksWithCourseMismatch) .With(x => x.DataLocksWithOnlyPriceMismatch, _dataLocksWithPriceMismatch) .Create(); //Act var dataLockSummary = _dataLockSummariesResponse.MapDataLockSummary(_allTrainingProgrammeResponse); var result = _apprenticeshipResponse.MapCourseDataLock(dataLockSummary.DataLockWithCourseMismatch, _priceEpisodes); //Assert var courseDataLock = result.FirstOrDefault(); Assert.AreEqual(_priceEpisodes.FirstOrDefault().FromDate, courseDataLock.CurrentStartDate); Assert.AreEqual(null, courseDataLock.CurrentEndDate); Assert.AreEqual(_apprenticeshipResponse.CourseName, courseDataLock.CurrentTrainingName); Assert.AreEqual(dataLockSummary.DataLockWithCourseMismatch.FirstOrDefault().IlrEffectiveFromDate, courseDataLock.IlrEffectiveFromDate); Assert.AreEqual(null, courseDataLock.IlrEffectiveToDate); Assert.AreEqual(_allTrainingProgrammeResponse.TrainingProgrammes.FirstOrDefault().Name, courseDataLock.IlrTrainingName); }
public void DataLockSummary_Throws_Exception_If_DataLock_CourseCode_Not_Exists() { //Arrange _dataLocksWithCourseMismatch = new List <DataLock> { new DataLock { IsResolved = false, DataLockStatus = Status.Fail, ErrorCode = DataLockErrorCode.Dlock04 } }; _dataLockSummariesResponse = _fixture.Build <GetDataLockSummariesResponse>() .With(x => x.DataLocksWithCourseMismatch, _dataLocksWithCourseMismatch) .Create(); var expectedMessage = $"Datalock {_dataLockSummariesResponse.DataLocksWithCourseMismatch.FirstOrDefault().Id} IlrTrainingCourseCode {_dataLockSummariesResponse.DataLocksWithCourseMismatch.FirstOrDefault().IlrTrainingCourseCode} not found; possible expiry"; //Act var exception = Assert.Throws <InvalidOperationException>(() => _dataLockSummariesResponse.MapDataLockSummary(_allTrainingProgrammeResponse)); //Assert Assert.AreEqual(expectedMessage, exception.Message); }
public void DataLockSummary_IsMapped() { //Arrange _dataLocksWithCourseMismatch = new List <DataLock> { new DataLock { IsResolved = false, DataLockStatus = Status.Fail, ErrorCode = DataLockErrorCode.Dlock04, IlrTrainingCourseCode = "548" } }; _dataLockSummariesResponse = _fixture.Build <GetDataLockSummariesResponse>() .With(x => x.DataLocksWithCourseMismatch, _dataLocksWithCourseMismatch) .Create(); //Act var result = _dataLockSummariesResponse.MapDataLockSummary(_allTrainingProgrammeResponse); //Assert Assert.AreEqual(1, result.DataLockWithCourseMismatch.Count()); }