public void ThenAnUntriagedDataLockCourseAndPriceIsMappedCorrectly() { _apprenticeship = new Domain.Entities.Apprenticeship { DataLocks = new List <DataLockStatusSummary> { new DataLockStatusSummary { ErrorCode = DataLockErrorCode.Dlock07, TriageStatus = TriageStatus.Unknown }, new DataLockStatusSummary { ErrorCode = DataLockErrorCode.Dlock03, TriageStatus = TriageStatus.Unknown } } }; //Act var result = _mapper.MapFromV2(_apprenticeship, CallerType.Employer); //Assert Assert.IsTrue(result.DataLockCourse); }
public void Setup() { _mockFacetMapper = new Mock <FacetMapper>(Mock.Of <ICurrentDateTime>()); _mockMediator = new Mock <IMediator>(); _mockApprenticeshipMapper = new Mock <IApprenticeshipMapper>(); _providerOrchestrator = new ProviderOrchestrator( _mockMediator.Object, Mock.Of <ICommitmentsLogger>(), _mockFacetMapper.Object, new ApprenticeshipFilterService(_mockFacetMapper.Object), _mockApprenticeshipMapper.Object, Mock.Of <ICommitmentMapper>()); _apprenticeshipsOrchestrator = new ApprenticeshipsOrchestrator(_mockMediator.Object, Mock.Of <IDataLockMapper>(), Mock.Of <IApprenticeshipMapper>(), Mock.Of <ICommitmentsLogger>()); _controller = new ProviderController(_providerOrchestrator, _apprenticeshipsOrchestrator); _newApprenticeship = new Domain.Entities.Apprenticeship { CommitmentId = TestCommitmentId, Id = TestApprenticeshipId }; _newApprenticeshipRequest = new ApiApprenticeship.ApprenticeshipRequest { Apprenticeship = new ApiApprenticeship.Apprenticeship(), LastUpdatedByInfo = new LastUpdateInfo { EmailAddress = "*****@*****.**", Name = "Bob" } }; }
private async Task CreateHistory(Commitment commitment, Domain.Entities.Apprenticeship apprenticeship, CallerType callerType, string userId, string userName) { var historyService = new HistoryService(_historyRepository); historyService.TrackUpdate(commitment, CommitmentChangeType.CreatedApprenticeship.ToString(), commitment.Id, null, callerType, userId, apprenticeship.ProviderId, apprenticeship.EmployerAccountId, userName); historyService.TrackInsert(apprenticeship, ApprenticeshipChangeType.Created.ToString(), null, apprenticeship.Id, callerType, userId, apprenticeship.ProviderId, apprenticeship.EmployerAccountId, userName); await historyService.Save(); }
private void AssertMappingIsCorrect(Domain.Entities.Apprenticeship argument) { argument.Id.Should().Be(_exampleValidRequest.Apprenticeship.Id); argument.FirstName.Should().Be(_exampleValidRequest.Apprenticeship.FirstName); argument.LastName.Should().Be(_exampleValidRequest.Apprenticeship.LastName); argument.CommitmentId.Should().Be(_exampleValidRequest.CommitmentId); argument.Cost.Should().Be(_exampleValidRequest.Apprenticeship.Cost); argument.StartDate.Should().Be(_exampleValidRequest.Apprenticeship.StartDate); argument.EndDate.Should().Be(_exampleValidRequest.Apprenticeship.EndDate); argument.TrainingType.Should().Be((TrainingType)_exampleValidRequest.Apprenticeship.TrainingType); argument.TrainingCode.Should().Be(_exampleValidRequest.Apprenticeship.TrainingCode); argument.TrainingName.Should().Be(_exampleValidRequest.Apprenticeship.TrainingName); argument.ULN.Should().Be(_exampleValidRequest.Apprenticeship.ULN); argument.PaymentStatus.Should().Be(PaymentStatus.PendingApproval); argument.AgreementStatus.Should().Be((AgreementStatus)_exampleValidRequest.Apprenticeship.AgreementStatus); }
public async Task ThenShouldCallTheRepositoryWithApprenticeshipMappedFromRequest() { Domain.Entities.Apprenticeship argument = null; _mockCommitmentRespository.Setup(x => x.GetCommitmentById(It.IsAny <long>())).ReturnsAsync(new Commitment { Id = _exampleValidRequest.CommitmentId, ProviderId = _exampleValidRequest.Caller.Id }); _mockApprenticeshipRepository .Setup(x => x.CreateApprenticeship(It.IsAny <Domain.Entities.Apprenticeship>())) .ReturnsAsync(_exampleValidRequest.Apprenticeship.Id) .Callback <Domain.Entities.Apprenticeship>((x) => argument = x); await _handler.Handle(_exampleValidRequest); argument.Should().NotBeNull(); AssertMappingIsCorrect(argument); }
public void ThenATriagedDataLockPriceOnlyIsMappedCorrectly() { _apprenticeship = new Domain.Entities.Apprenticeship { DataLocks = new List <DataLockStatusSummary> { new DataLockStatusSummary { ErrorCode = DataLockErrorCode.Dlock07, TriageStatus = TriageStatus.Change } } }; //Act var result = _mapper.MapFromV2(_apprenticeship, CallerType.Employer); //Assert Assert.IsTrue(result.DataLockPriceTriaged); }
public void ThenATriagedAsRestartDataLockCourseIsMappedCorrectly() { _apprenticeship = new Domain.Entities.Apprenticeship { DataLocks = new List <DataLockStatusSummary> { new DataLockStatusSummary { ErrorCode = DataLockErrorCode.Dlock04, TriageStatus = TriageStatus.Restart } } }; //Act var result = _mapper.MapFromV2(_apprenticeship, CallerType.Employer); //Assert Assert.IsFalse(result.DataLockCourse); Assert.IsFalse(result.DataLockCourseChangeTriaged); Assert.IsTrue(result.DataLockCourseTriaged); }
public void Setup() { _validator = new CreateApprenticeshipValidator(new ApprenticeshipValidator(new StubCurrentDateTime(), Mock.Of <IUlnValidator>(), Mock.Of <IAcademicYearValidator>())); var exampleValidApprenticeship = new Domain.Entities.Apprenticeship { FirstName = "Bob", LastName = "Smith", NINumber = ApprenticeshipTestDataHelper.CreateValidNino(), ULN = ApprenticeshipTestDataHelper.CreateValidULN(), ProviderRef = "Provider ref", EmployerRef = null, StartDate = DateTime.Now.AddYears(5), EndDate = DateTime.Now.AddYears(7) }; _exampleCommand = new CreateApprenticeshipCommand { Caller = new Caller { CallerType = CallerType.Provider, Id = 1 }, CommitmentId = 123L, Apprenticeship = exampleValidApprenticeship }; }
public void Setup() { _apprenticeship = new Domain.Entities.Apprenticeship(); _mapper = new ApprenticeshipMapper(); }