Esempio n. 1
0
 public PaymentService(
     IClassMapper classMapper,
     IUnitOfWorkFactory unitOfWorkFactory,
     BankDomainService bankDomainService,
     ProviderDomainService providerDomainService)
 {
     this.classMapper           = classMapper;
     this.unitOfWorkFactory     = unitOfWorkFactory;
     this.bankDomainService     = bankDomainService;
     this.providerDomainService = providerDomainService;
 }
Esempio n. 2
0
        public PaymentServiceTest()
        {
            this.logger         = new Mock <ILogger>();
            this.jsonSerializer = new Mock <IJsonSerializer>();
            this.xmlSerializer  = new Mock <IXmlSerializer>();
            this.bankBinQuery   = new BankDomainService(bankValidation, bankBinRepository);

            IEnumerable <PaymentProvider> paymentProviders = new List <PaymentProvider>
            {
                new ESTPaymentIntegration(logger.Object, jsonSerializer.Object, xmlSerializer.Object, bankBinQuery),
                new IPARAPaymentIntegration(logger.Object, jsonSerializer.Object, xmlSerializer.Object, bankBinQuery),
                new MPIPaymentIntegration(logger.Object, jsonSerializer.Object, xmlSerializer.Object, bankBinQuery),
                new PAYTENPaymentIntegration(logger.Object, jsonSerializer.Object, xmlSerializer.Object, bankBinQuery)
            };

            var mapperConfiguration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <DoPaymentRequest, PaymentRequest>();
            });

            IMapper mapper = mapperConfiguration.CreateMapper();

            this.classMapper            = new ClassMapper(mapper);
            this.httpContextAccessor    = new Mock <IHttpContextAccessor>();
            this.dbContextFactory       = new DbContextFactory();
            this.unitOfWorkFactory      = new UnitOfWorkFactory(httpContextAccessor.Object, dbContextFactory);
            this.bankBinRepository      = new BankBinRepository(unitOfWorkFactory);
            this.bankProviderRepository = new BankProviderRepository(unitOfWorkFactory);
            this.providerRepository     = new ProviderRepository(unitOfWorkFactory);
            this.bankValidation         = new BankValidation(bankBinRepository, bankProviderRepository);
            this.bankDomainService      = new BankDomainService(bankValidation, bankBinRepository);
            this.providerValidation     = new ProviderValidation(paymentProviders, providerRepository);
            this.providerDomainService  = new ProviderDomainService(providerValidation, providerRepository);
            this.paymentService         = new PaymentService(
                classMapper,
                unitOfWorkFactory,
                bankDomainService,
                providerDomainService);
        }