Beispiel #1
0
        public void Setup()
        {
            _mockMediator = new Mock <IMediator>();
            _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetOverlappingApprenticeshipsRequest>()))
            .ReturnsAsync(new GetOverlappingApprenticeshipsResponse
            {
                Data = new List <ApprenticeshipResult>()
            });

            _currentDateTime = new Mock <ICurrentDateTime>();
            _currentDateTime.Setup(x => x.Now).Returns(new DateTime(2018, 1, 1));

            _mockCommitmentRespository     = new Mock <ICommitmentRepository>();
            _mockApprenticeshipRespository = new Mock <IApprenticeshipRepository>();
            _mockApprenticeshipRespository.Setup(x => x.GetActiveApprenticeshipsByUlns(It.IsAny <IEnumerable <string> >())).ReturnsAsync(new List <ApprenticeshipResult>());
            _mockApprenticeshipEventsList      = new Mock <IApprenticeshipEventsList>();
            _mockApprenticeshipEventsPublisher = new Mock <IApprenticeshipEventsPublisher>();
            _mockHistoryRepository             = new Mock <IHistoryRepository>();
            _handler = new UpdateCommitmentAgreementCommandHandler(
                _mockCommitmentRespository.Object,
                _mockApprenticeshipRespository.Object,
                new ApprenticeshipUpdateRules(),
                Mock.Of <ICommitmentsLogger>(),
                _mockMediator.Object,
                new UpdateCommitmentAgreementCommandValidator(),
                _mockApprenticeshipEventsList.Object,
                _mockApprenticeshipEventsPublisher.Object,
                _mockHistoryRepository.Object,
                _currentDateTime.Object);

            _validCommand = new UpdateCommitmentAgreementCommand
            {
                Caller = new Domain.Caller {
                    Id = 444, CallerType = Domain.CallerType.Employer
                },
                LatestAction       = LastAction.Amend,
                CommitmentId       = 123L,
                LastUpdatedByName  = "Test Tester",
                LastUpdatedByEmail = "*****@*****.**"
            };
        }
Beispiel #2
0
        public void Setup()
        {
            _mockCommitmentRespository     = new Mock <ICommitmentRepository>();
            _mockApprenticeshipRespository = new Mock <IApprenticeshipRepository>();
            _mockApprenticeshipRespository.Setup(x => x.GetActiveApprenticeshipsByUlns(It.IsAny <IEnumerable <string> >())).ReturnsAsync(new List <ApprenticeshipResult>());
            _mockApprenticeshipEventsList      = new Mock <IApprenticeshipEventsList>();
            _mockApprenticeshipEventsPublisher = new Mock <IApprenticeshipEventsPublisher>();
            _mockHistoryRepository             = new Mock <IHistoryRepository>();
            _messagePublisher       = new Mock <IMessagePublisher>();
            _notificationsPublisher = new Mock <INotificationsPublisher>();

            V2EventsPublisher = new Mock <IV2EventsPublisher>();
            V2EventsPublisher.Setup(x => x.SendProviderSendCohortCommand(It.IsAny <long>(), It.IsAny <string>(), It.IsAny <UserInfo>()))
            .Returns(Task.CompletedTask);

            _handler = new UpdateCommitmentAgreementCommandHandler(
                _mockCommitmentRespository.Object,
                _mockApprenticeshipRespository.Object,
                new ApprenticeshipUpdateRules(),
                Mock.Of <ICommitmentsLogger>(),
                new UpdateCommitmentAgreementCommandValidator(),
                _mockApprenticeshipEventsList.Object,
                _mockApprenticeshipEventsPublisher.Object,
                _mockHistoryRepository.Object,
                _messagePublisher.Object,
                _notificationsPublisher.Object,
                V2EventsPublisher.Object);

            _validCommand = new UpdateCommitmentAgreementCommand
            {
                Caller = new Domain.Caller {
                    Id = 444, CallerType = Domain.CallerType.Provider
                },
                LatestAction       = LastAction.Amend,
                CommitmentId       = 123L,
                LastUpdatedByName  = "Test Tester",
                LastUpdatedByEmail = "*****@*****.**"
            };
        }