Exemple #1
0
 public GetMovementDateHistoryHandler(IMovementDateHistoryRepository historyRepository,
                                      IMovementRepository movementRepository,
                                      IMapper mapper)
 {
     this.historyRepository  = historyRepository;
     this.mapper             = mapper;
     this.movementRepository = movementRepository;
 }
        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)));
        }
Exemple #4
0
 public GetOriginalDateTests()
 {
     historyRepository = A.Fake <IMovementDateHistoryRepository>();
 }
 public GetOriginalDateTests()
 {
     historyRepository = A.Fake<IMovementDateHistoryRepository>();
 }
 public OriginalMovementDate(IMovementDateHistoryRepository historyRepository)
 {
     this.historyRepository = historyRepository;
 }
 public OriginalMovementDate(IMovementDateHistoryRepository historyRepository)
 {
     this.historyRepository = historyRepository;
 }