public void Arrange() { _command = new RefreshPaymentDataCommand { AccountId = AccountId, PeriodEnd = PeriodEnd }; _existingPaymentIds = new List <Guid> { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() }; _validator = new Mock <IValidator <RefreshPaymentDataCommand> >(); _validator.Setup(x => x.Validate(It.IsAny <RefreshPaymentDataCommand>())) .Returns(new ValidationResult { ValidationDictionary = new Dictionary <string, string>() }); _dasLevyRepository = new Mock <IDasLevyRepository>(); _dasLevyRepository.Setup(x => x.GetAccountPaymentIds(It.IsAny <long>())) .ReturnsAsync(new HashSet <Guid>(_existingPaymentIds)); _paymentDetails = new List <PaymentDetails> { new PaymentDetails { Id = Guid.NewGuid(), Amount = Amount, EmployerAccountId = AccountId, ProviderName = ProviderName } }; _paymentService = new Mock <IPaymentService>(); _paymentService.Setup(x => x.GetAccountPayments(It.IsAny <string>(), It.IsAny <long>())) .ReturnsAsync(_paymentDetails); _mediator = new Mock <IMediator>(); _logger = new Mock <ILog>(); _eventPublisher = new TestableEventPublisher(); _handler = new RefreshPaymentDataCommandHandler( _eventPublisher, _validator.Object, _paymentService.Object, _dasLevyRepository.Object, _mediator.Object, _logger.Object); }
public void Arrange() { _command = new RefreshPaymentDataCommand { AccountId = 546578, PeriodEnd = "R12-13", PaymentUrl = "http://someurl" }; _existingPaymentIds = new List <Guid> { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() }; _validator = new Mock <IValidator <RefreshPaymentDataCommand> >(); _validator.Setup(x => x.Validate(It.IsAny <RefreshPaymentDataCommand>())) .Returns(new ValidationResult { ValidationDictionary = new Dictionary <string, string> () }); _dasLevyRepository = new Mock <IPaymentsRepository>(); _dasLevyRepository.Setup(x => x.GetAccountPaymentIds(It.IsAny <long>())) .ReturnsAsync(_existingPaymentIds); _paymentDetails = new List <PaymentDetails> { new PaymentDetails { Id = Guid.NewGuid().ToString() } }; _paymentService = new Mock <IPaymentService>(); _paymentService.Setup(x => x.GetAccountPayments(It.IsAny <string>(), It.IsAny <long>())) .ReturnsAsync(_paymentDetails); _mediator = new Mock <IMediator>(); _logger = new Mock <ILog>(); _handler = new RefreshPaymentDataCommandHandler( _validator.Object, _paymentService.Object, _dasLevyRepository.Object, _mediator.Object, _logger.Object); }