public MovementFactoryTests() { SystemTime.Freeze(Today); shipmentRepository = A.Fake <IShipmentInfoRepository>(); movementRepository = A.Fake <IMovementRepository>(); assessmentRepository = A.Fake <INotificationAssessmentRepository>(); financialGuaranteeRepository = A.Fake <IFinancialGuaranteeRepository>(); consentRepository = A.Fake <INotificationConsentRepository>(); workingDayCalculator = A.Fake <IWorkingDayCalculator>(); notificationApplicationRepository = A.Fake <INotificationApplicationRepository>(); financialGuaranteeRepository = A.Fake <IFinancialGuaranteeRepository>(); movementPartialRejectionRepository = A.Fake <IMovementPartialRejectionRepository>(); dateValidator = A.Fake <IMovementDateValidator>(); var movementNumberGenerator = new MovementNumberGenerator(new NextAvailableMovementNumberGenerator(movementRepository), movementRepository, shipmentRepository); var numberOfMovements = new NumberOfMovements(movementRepository, shipmentRepository); var movementsQuatity = new NotificationMovementsQuantity(movementRepository, shipmentRepository, movementPartialRejectionRepository); var numberOfActiveLoads = new NumberOfActiveLoads(movementRepository, financialGuaranteeRepository); var consentPeriod = new ConsentPeriod(consentRepository, workingDayCalculator, notificationApplicationRepository); factory = new MovementFactory(numberOfMovements, movementsQuatity, assessmentRepository, movementNumberGenerator, numberOfActiveLoads, consentPeriod, dateValidator, financialGuaranteeRepository, A.Fake <IUserContext>()); }
public MovementFactoryTests() { SystemTime.Freeze(Today); shipmentRepository = A.Fake<IShipmentInfoRepository>(); movementRepository = A.Fake<IMovementRepository>(); assessmentRepository = A.Fake<INotificationAssessmentRepository>(); financialGuaranteeRepository = A.Fake<IFinancialGuaranteeRepository>(); consentRepository = A.Fake<INotificationConsentRepository>(); workingDayCalculator = A.Fake<IWorkingDayCalculator>(); notificationApplicationRepository = A.Fake<INotificationApplicationRepository>(); financialGuaranteeRepository = A.Fake<IFinancialGuaranteeRepository>(); dateValidator = A.Fake<IMovementDateValidator>(); var movementNumberGenerator = new MovementNumberGenerator(new NextAvailableMovementNumberGenerator(movementRepository), movementRepository, shipmentRepository); var numberOfMovements = new NumberOfMovements(movementRepository, shipmentRepository); var movementsQuatity = new NotificationMovementsQuantity(movementRepository, shipmentRepository); var numberOfActiveLoads = new NumberOfActiveLoads(movementRepository, financialGuaranteeRepository); var consentPeriod = new ConsentPeriod(consentRepository, workingDayCalculator, notificationApplicationRepository); factory = new MovementFactory(numberOfMovements, movementsQuatity, assessmentRepository, movementNumberGenerator, numberOfActiveLoads, consentPeriod, dateValidator, financialGuaranteeRepository, A.Fake<IUserContext>()); }
public ConsentPeriod(INotificationConsentRepository consentRepository, IWorkingDayCalculator workingDayCalculator, INotificationApplicationRepository notificationApplicationRepository) { this.consentRepository = consentRepository; this.workingDayCalculator = workingDayCalculator; this.notificationApplicationRepository = notificationApplicationRepository; }
public PrenotificationContentThreeWorkingDaysRule(INotificationConsentRepository consentRepository, IWorkingDayCalculator workingDayCalculator, INotificationApplicationRepository notificationApplicationRepository) { this.consentRepository = consentRepository; this.workingDayCalculator = workingDayCalculator; this.notificationApplicationRepository = notificationApplicationRepository; }
public UpdatedMovementDateValidator(IMovementDateValidator movementDateValidator, OriginalMovementDate originalMovementDate, IWorkingDayCalculator workingDayCalculator, INotificationApplicationRepository notificationRepository) { this.originalMovementDate = originalMovementDate; this.workingDayCalculator = workingDayCalculator; this.notificationRepository = notificationRepository; this.movementDateValidator = movementDateValidator; }
public PrenotificationContentThreeWorkingDaysRuleTests() { consentRepository = A.Fake <INotificationConsentRepository>(); workingDayCalculator = A.Fake <IWorkingDayCalculator>(); var notificationApplicationRepository = A.Fake <INotificationApplicationRepository>(); rule = new PrenotificationThreeWorkingDaysConsentRule(consentRepository, workingDayCalculator, notificationApplicationRepository); notificationId = Guid.NewGuid(); }
public DateTime?GetDecisionRequiredDate(IWorkingDayCalculator workingDayCalculator, UKCompetentAuthority competentAuthority) { DateTime?returnDate = null; if (CompletedDate.HasValue) { returnDate = workingDayCalculator.AddWorkingDays(CompletedDate.Value, WorkingDaysUntilDecisionRequired, false, competentAuthority); } return(returnDate); }
public DateTime? GetDecisionRequiredDate(IWorkingDayCalculator workingDayCalculator, UKCompetentAuthority competentAuthority) { DateTime? returnDate = null; if (CompletedDate.HasValue) { returnDate = workingDayCalculator.AddWorkingDays(CompletedDate.Value, WorkingDaysUntilDecisionRequired, false, competentAuthority); } return returnDate; }
public MovementDateValidatorTests() { consentRepository = A.Fake <INotificationConsentRepository>(); notificationRepository = A.Fake <INotificationApplicationRepository>(); historyRepository = A.Fake <IMovementDateHistoryRepository>(); workingDayCalculator = A.Fake <IWorkingDayCalculator>(); dateValidator = new MovementDateValidator(consentRepository); originalMovementDate = new OriginalMovementDate(historyRepository); updatedDateValidator = new UpdatedMovementDateValidator(dateValidator, originalMovementDate, workingDayCalculator, notificationRepository); SystemTime.Freeze(Today.AddHours(5)); A.CallTo(() => consentRepository.GetByNotificationId(NotificationId)) .Returns(new Consent( NotificationId, new DateRange(ConsentStart, ConsentEnd), AnyString, AnyGuid)); A.CallTo(() => notificationRepository.GetByMovementId(A <Guid> .Ignored)) .Returns(new NotificationApplication( AnyGuid, NotificationType.Recovery, UKCompetentAuthority.England, 10)); A.CallTo(() => historyRepository.GetByMovementId(A <Guid> .Ignored)) .Returns(new MovementDateHistory[0]); A.CallTo(() => workingDayCalculator.AddWorkingDays(A <DateTime> .Ignored, A <int> .Ignored, A <bool> .Ignored, A <UKCompetentAuthority> .Ignored)) .ReturnsLazily((DateTime inputDate, int inputDays, bool includeStartDay, UKCompetentAuthority ca) => //A very simple working day formula that ignores bank holidays taken from http://stackoverflow.com/a/279370 inputDate.AddDays(inputDays + ((inputDays / 5) * 2) + ((((int)inputDate.DayOfWeek + (inputDays % 5)) >= 5) ? 2 : 0))); }
public MovementDateValidatorTests() { consentRepository = A.Fake<INotificationConsentRepository>(); notificationRepository = A.Fake<INotificationApplicationRepository>(); historyRepository = A.Fake<IMovementDateHistoryRepository>(); workingDayCalculator = A.Fake<IWorkingDayCalculator>(); dateValidator = new MovementDateValidator(consentRepository); originalMovementDate = new OriginalMovementDate(historyRepository); updatedDateValidator = new UpdatedMovementDateValidator(dateValidator, originalMovementDate, workingDayCalculator, notificationRepository); SystemTime.Freeze(Today.AddHours(5)); A.CallTo(() => consentRepository.GetByNotificationId(NotificationId)) .Returns(new Consent( NotificationId, new DateRange(ConsentStart, ConsentEnd), AnyString, AnyGuid)); A.CallTo(() => notificationRepository.GetByMovementId(A<Guid>.Ignored)) .Returns(new NotificationApplication( AnyGuid, NotificationType.Recovery, UKCompetentAuthority.England, 10)); A.CallTo(() => historyRepository.GetByMovementId(A<Guid>.Ignored)) .Returns(new MovementDateHistory[0]); A.CallTo(() => workingDayCalculator.AddWorkingDays(A<DateTime>.Ignored, A<int>.Ignored, A<bool>.Ignored, A<UKCompetentAuthority>.Ignored)) .ReturnsLazily((DateTime inputDate, int inputDays, bool includeStartDay, UKCompetentAuthority ca) => //A very simple working day formula that ignores bank holidays taken from http://stackoverflow.com/a/279370 inputDate.AddDays(inputDays + ((inputDays / 5) * 2) + ((((int)inputDate.DayOfWeek + (inputDays % 5)) >= 5) ? 2 : 0))); }
public GetWorkingDaysUntilHandler(IWorkingDayCalculator workingDayCalculator, INotificationApplicationRepository notificationApplicationRepository) { this.workingDayCalculator = workingDayCalculator; this.notificationApplicationRepository = notificationApplicationRepository; }
public DecisionRequiredByCalculator(IWorkingDayCalculator workingDayCalculator) { this.workingDayCalculator = workingDayCalculator; }
public ShipmentMap(IWorkingDayCalculator workingDayCalculator) { this.workingDayCalculator = workingDayCalculator; }
public DataImportNotificationMap(IWorkingDayCalculator workingDayCalculator, IDecisionRequiredByCalculator decisionRequiredByCalculator) { this.workingDayCalculator = workingDayCalculator; this.decisionRequiredByCalculator = decisionRequiredByCalculator; }
public WorkingDaysController(IWorkingDayCalculator calculator) { _calculator = calculator; }