Example #1
0
 public PrenotificationContentConsentValidityRuleTests()
 {
     notificationConsentRepository = A.Fake <INotificationConsentRepository>();
     rule           = new PrenotificationConsentValidityRule(notificationConsentRepository);
     notificationId = Guid.NewGuid();
     consent        = new Consent(Guid.NewGuid(), GetTestConsentDateRange(), string.Empty, Guid.NewGuid());
 }
        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>());
        }
Example #3
0
        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 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;
 }
Example #6
0
 public ConsentPeriod(INotificationConsentRepository consentRepository,
                      IWorkingDayCalculator workingDayCalculator,
                      INotificationApplicationRepository notificationApplicationRepository)
 {
     this.consentRepository    = consentRepository;
     this.workingDayCalculator = workingDayCalculator;
     this.notificationApplicationRepository = notificationApplicationRepository;
 }
Example #7
0
 public ConsentNotification(INotificationConsentRepository consentRepository,
                            INotificationAssessmentRepository assessmentRepository,
                            IUserContext userContext)
 {
     this.consentRepository    = consentRepository;
     this.assessmentRepository = assessmentRepository;
     this.userContext          = userContext;
 }
Example #8
0
 public GetShipmentInfoHandler(INotificationConsentRepository consentRepository,
                               IShipmentInfoRepository shipmentInfoRepository,
                               INotificationApplicationRepository notificationRepository,
                               IMapper mapper)
 {
     this.consentRepository      = consentRepository;
     this.shipmentInfoRepository = shipmentInfoRepository;
     this.notificationRepository = notificationRepository;
     this.mapper = mapper;
 }
        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 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)));
        }
Example #12
0
 public MovementDateValidator(INotificationConsentRepository consentRepository)
 {
     this.consentRepository = consentRepository;
 }
Example #13
0
 public PrenotificationConsentValidityRule(INotificationConsentRepository notificationConsentRepository)
 {
     this.notificationConsentRepository = notificationConsentRepository;
 }