public void SetUp()
        {
            _messageHandlerContext       = new TestableMessageHandlerContext();
            _paymentsEventsApiClientMock = new Mock <IPaymentsEventsApiClient>();
            _mediatorMock = new Mock <IMediator>();
            _loggerMock   = new Mock <ILog>();

            _mediatorMock
            .Setup(mock => mock.SendAsync(It.IsAny <GetPeriodEndsRequest>()))
            .ReturnsAsync(new GetPeriodEndsResponse {
                CurrentPeriodEnds = new List <DbPeriodEnd>()
            });

            Fixture.Customize <Account>(x => x.Without(s => s.AccountLegalEntities));

            _mediatorMock.Setup(mock => mock.SendAsync(It.IsAny <GetAllEmployerAccountsRequest>()))
            .ReturnsAsync(new GetAllEmployerAccountsResponse {
                Accounts = new List <Account> {
                    Fixture.Create <Account>()
                }
            });

            _configuration = new PaymentsApiClientConfiguration {
                PaymentsDisabled = false
            };

            _sut = new ImportPaymentsCommandHandler(_paymentsEventsApiClientMock.Object, _mediatorMock.Object, _loggerMock.Object, _configuration);
        }
 public PaymentProcessor(IPaymentsEventsApiClient paymentsEventsApiClient, IMediator mediator, IMessagePublisher publisher, ILog logger, PaymentsApiClientConfiguration configuration)
 {
     _paymentsEventsApiClient = paymentsEventsApiClient;
     _mediator      = mediator;
     _publisher     = publisher;
     _logger        = logger;
     _configuration = configuration;
 }
示例#3
0
 public ImportPaymentsCommandHandler(
     IPaymentsEventsApiClient paymentsEventsApiClient,
     IMediator mediator,
     ILog logger,
     PaymentsApiClientConfiguration configuration)
 {
     _paymentsEventsApiClient = paymentsEventsApiClient;
     _mediator      = mediator;
     _logger        = logger;
     _configuration = configuration;
 }
        public void Arrange()
        {
            _paymentsClient = new Mock <IPaymentsEventsApiClient>();
            _mediator       = new Mock <IMediator>();
            _mediator.Setup(x => x.SendAsync(It.IsAny <GetCurrentPeriodEndRequest>())).ReturnsAsync(new GetPeriodEndResponse {
                CurrentPeriodEnd = new EmployerPayments.Domain.Models.Payments.PeriodEnd {
                    Id = "123456"
                }
            });
            _mediator.Setup(x => x.SendAsync(It.IsAny <GetAccountsQuery>())).ReturnsAsync(new GetAccountsResponse {
                AccountIds = new List <long> {
                    ExpectedAccountId
                }
            });

            _logger = new Mock <ILog>();

            _configuration = new PaymentsApiClientConfiguration();

            _messagePublisher = new Mock <IMessagePublisher>();
            _paymentProcessor = new PaymentProcessor(_paymentsClient.Object, _mediator.Object, _messagePublisher.Object, _logger.Object, _configuration);
        }