Beispiel #1
0
        public void Setup()
        {
            _validCommand = new SubmitCommitmentCommand {
                EmployerAccountId = 12L, CommitmentId = 2L, UserDisplayName = "Test User", UserEmailAddress = "*****@*****.**", UserId = "externalUserId"
            };
            _repositoryCommitment = new CommitmentView
            {
                ProviderId        = 456L,
                EmployerAccountId = 12L,
                AgreementStatus   = AgreementStatus.NotAgreed,
                Reference         = CohortReference
            };

            _mockCommitmentApi = new Mock <IEmployerCommitmentApi>();
            _mockCommitmentApi.Setup(x => x.GetEmployerCommitment(It.IsAny <long>(), It.IsAny <long>()))
            .ReturnsAsync(_repositoryCommitment);

            var config = new EmployerCommitmentsServiceConfiguration
            {
                CommitmentNotification = new CommitmentNotificationConfiguration {
                    SendEmail = true
                }
            };

            _mockEmailService = new Mock <IProviderEmailService>();

            _handler = new SubmitCommitmentCommandHandler(_mockCommitmentApi.Object, config, Mock.Of <ILog>(), _mockEmailService.Object);
        }
        public void Setup()
        {
            _validCommand = new SubmitCommitmentCommand {
                EmployerAccountId = 12L, CommitmentId = 2L, UserDisplayName = "Test User", UserEmailAddress = "*****@*****.**", UserId = "externalUserId"
            };
            _repositoryCommitment = new CommitmentView
            {
                ProviderId        = 456L,
                EmployerAccountId = 12L,
                AgreementStatus   = AgreementStatus.NotAgreed
            };

            _mockCommitmentApi = new Mock <IEmployerCommitmentApi>();
            _mockCommitmentApi.Setup(x => x.GetEmployerCommitment(It.IsAny <long>(), It.IsAny <long>()))
            .ReturnsAsync(_repositoryCommitment);

            _mockMediator = new Mock <IMediator>();
            var config = new EmployerApprenticeshipsServiceConfiguration
            {
                CommitmentNotification = new CommitmentNotificationConfiguration {
                    SendEmail = true
                }
            };

            _mockEmailLookup = new Mock <IProviderEmailLookupService>();
            _mockEmailLookup.Setup(m => m.GetEmailsAsync(It.IsAny <long>(), It.IsAny <string>())).ReturnsAsync(new List <string>());

            _handler = new SubmitCommitmentCommandHandler(_mockCommitmentApi.Object, _mockMediator.Object, config, _mockEmailLookup.Object, Mock.Of <ILogger>());
        }