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>()); }
public void Arrange() { _validator = new SubmitCommitmentCommandValidator(); _validCommand = new SubmitCommitmentCommand { EmployerAccountId = 1L, CommitmentId = 2L }; }
public void Setup() { _validCommand = new SubmitCommitmentCommand() { ProviderId = 111L, HashedCommitmentId = "ABC123", CommitmentId = 123L, Message = "Test Message", CreateTask = true, LastAction = LastAction.Approve, UserDisplayName = "Test User", UserEmailAddress = "*****@*****.**", UserId = "user123" }; _mockCommitmentsApi = new Mock <IProviderCommitmentsApi>(); _mockCommitmentsApi.Setup(x => x.GetProviderCommitment(_validCommand.ProviderId, _validCommand.CommitmentId)) .ReturnsAsync(new CommitmentView { ProviderId = _validCommand.ProviderId, AgreementStatus = AgreementStatus.NotAgreed, Reference = "ABC123", EmployerLastUpdateInfo = new LastUpdateInfo { EmailAddress = "EmployerTestEmail" }, ProviderName = "ProviderName", EmployerAccountId = 100 }); _mockHashingService = new Mock <IHashingService>(); _mockHashingService.Setup(x => x.HashValue(It.IsAny <long>())).Returns <long>((p) => "HS" + p.ToString()); var configuration = new ProviderApprenticeshipsServiceConfiguration { EnableEmailNotifications = true }; _mockMediator = new Mock <IMediator>(); _handler = new SubmitCommitmentCommandHandler(_mockCommitmentsApi.Object, new SubmitCommitmentCommandValidator(), _mockMediator.Object, configuration, _mockHashingService.Object); }
public void Setup() { _validCommand = new SubmitCommitmentCommand() { ProviderId = 111L, HashedCommitmentId = "ABC123", CommitmentId = 123L, Message = "Test Message", CreateTask = true, LastAction = LastAction.Amend, UserDisplayName = "Test User", UserEmailAddress = "*****@*****.**", UserId = "user123", }; _mockHashingService = new Mock <IHashingService>(); _mockCommitmentsApi = new Mock <IProviderCommitmentsApi>(); _mockMediator = new Mock <IMediator>(); _handler = new SubmitCommitmentCommandHandler(_mockCommitmentsApi.Object, new SubmitCommitmentCommandValidator(), _mockMediator.Object, new ProviderApprenticeshipsServiceConfiguration(), _mockHashingService.Object); }