public DataLockUpdater(ILog logger, IPaymentEvents paymentEventsService, IDataLockRepository dataLockRepository, IApprenticeshipUpdateRepository apprenticeshipUpdateRepository, CommitmentPaymentsConfiguration config, IFilterOutAcademicYearRollOverDataLocks filter, IApprenticeshipRepository apprenticeshipRepository) { _logger = logger; _paymentEventsSerivce = paymentEventsService; _dataLockRepository = dataLockRepository; _apprenticeshipUpdateRepository = apprenticeshipUpdateRepository; _config = config; _filterAcademicYearRolloverDataLocks = filter; _apprenticeshipRepository = apprenticeshipRepository; _whiteList = new List <DataLockErrorCode> { DataLockErrorCode.Dlock03, DataLockErrorCode.Dlock04, DataLockErrorCode.Dlock05, DataLockErrorCode.Dlock06, DataLockErrorCode.Dlock07 }; }
private void ConfigurePaymentsApiService(CommitmentPaymentsConfiguration config) { if (config.UseDocumentRepository) { For <IPaymentEvents>().Use <PaymentEventsDocumentSerivce>() .Ctor <string>().Is(config.StorageConnectionString ?? "UseDevelopmentStorage=true"); } else { For <IPaymentEvents>().Use <PaymentEventsService>(); } }
public DataLockUpdater(ILog logger, IPaymentEvents paymentEventsService, IDataLockRepository dataLockRepository, IApprenticeshipUpdateRepository apprenticeshipUpdateRepository, CommitmentPaymentsConfiguration config, IFilterOutAcademicYearRollOverDataLocks filter, IApprenticeshipRepository apprenticeshipRepository) { if (logger == null) { throw new ArgumentNullException(nameof(ILog)); } if (paymentEventsService == null) { throw new ArgumentNullException(nameof(IPaymentEvents)); } if (dataLockRepository == null) { throw new ArgumentNullException(nameof(IDataLockRepository)); } if (apprenticeshipUpdateRepository == null) { throw new ArgumentNullException(nameof(IApprenticeshipUpdateRepository)); } if (config == null) { throw new ArgumentNullException(nameof(CommitmentPaymentsConfiguration)); } if (filter == null) { throw new ArgumentNullException(nameof(IFilterOutAcademicYearRollOverDataLocks)); } _logger = logger; _paymentEventsSerivce = paymentEventsService; _dataLockRepository = dataLockRepository; _apprenticeshipUpdateRepository = apprenticeshipUpdateRepository; _config = config; _filterAcademicYearRolloverDataLocks = filter; _apprenticeshipRepository = apprenticeshipRepository; _whiteList = new List <DataLockErrorCode> { DataLockErrorCode.Dlock03, DataLockErrorCode.Dlock04, DataLockErrorCode.Dlock05, DataLockErrorCode.Dlock06, DataLockErrorCode.Dlock07 }; }
public void Arrange() { _dataLockRepository = new Mock <IDataLockRepository>(); _paymentEvents = new Mock <IPaymentEvents>(); _apprenticeshipUpdateRepository = new Mock <IApprenticeshipUpdateRepository>(); _config = new CommitmentPaymentsConfiguration(); _apprenticeshipRepository = new Mock <IApprenticeshipRepository>(); _dataLockRepository.Setup(x => x.GetLastDataLockEventId()).ReturnsAsync(1L); _dataLockRepository.Setup(x => x.UpdateDataLockStatus(It.IsAny <DataLockStatus>())).ReturnsAsync(0L); _paymentEvents.Setup(x => x.GetDataLockEvents( It.IsAny <long>(), It.IsAny <DateTime?>(), It.IsAny <string>(), It.IsAny <long>(), It.IsAny <int>())) .ReturnsAsync(new List <DataLockStatus>()); _apprenticeshipUpdateRepository.Setup(x => x.GetPendingApprenticeshipUpdate(It.IsAny <long>())) .ReturnsAsync((ApprenticeshipUpdate)null); _apprenticeshipRepository = new Mock <IApprenticeshipRepository>(); _apprenticeshipRepository.Setup(x => x.GetApprenticeship(It.IsAny <long>())) .ReturnsAsync(new Apprenticeship { PaymentStatus = PaymentStatus.Active }); _dataLockUpdater = new DataLockUpdater( Mock.Of <ILog>(), _paymentEvents.Object, _dataLockRepository.Object, _apprenticeshipUpdateRepository.Object, _config, Mock.Of <IFilterOutAcademicYearRollOverDataLocks>(), _apprenticeshipRepository.Object ); }