private async Task <IOperationsFetcher> CreateSutInstanceAsync(
            string inMemoryDatabaseName = "operations_fetcher_tests",
            Func <IOperationsRepository, IOperationRequestsRepository, Task> seedAction = null)
        {
            var options = new DbContextOptionsBuilder <PbfContext>()
                          .UseInMemoryDatabase(inMemoryDatabaseName)
                          .Options;

            var dbFactory = new PostgreSQLContextFactory <PbfContext>(opts => new PbfContext(options, true), options);

            _operationsRepository = new OperationsRepository(dbFactory);

            _operationRequestsRepository = new OperationRequestsRepository(
                dbFactory,
                new SqlRepositoryHelper(new MemoryCache(new MemoryCacheOptions()), EmptyLogFactory.Instance));

            _executorClient = Mock.Of <IQuorumOperationExecutorClient>();

            if (seedAction != null)
            {
                await seedAction.Invoke(_operationsRepository, _operationRequestsRepository);
            }

            return(new OperationsFetcher(
                       MaxNewOperationsAmount,
                       MaxAcceptedOperationsAmount,
                       _operationsRepository,
                       _operationRequestsRepository
                       ));
        }
Beispiel #2
0
 public CustomerProfileRepository(
     PostgreSQLContextFactory <BonusCustomerProfileContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory ?? throw new ArgumentNullException(nameof(msSqlContextFactory));
     _mapper = mapper;
 }
 public CustomersRegistrationReferralDataRepository(
     PostgreSQLContextFactory <CmContext> contextFactory,
     ILogFactory logFactory)
 {
     _contextFactory = contextFactory;
     _log            = logFactory.CreateLog(this);
 }
 public CampaignCompletionRepository(
     PostgreSQLContextFactory <BonusEngineContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory;
     _mapper = mapper;
 }
Beispiel #5
0
 public VoucherOperationsStatisticRepository(
     PostgreSQLContextFactory <DashboardStatisticsContext> contextFactory,
     IMapper mapper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public PartnerRepository(
     PostgreSQLContextFactory <PartnerManagementContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory;
     _mapper = mapper;
 }
 public ReferralLeadProfileRepository(
     PostgreSQLContextFactory <CustomerProfileContext> contextFactory,
     IEncryptionService encryptionService)
 {
     _contextFactory    = contextFactory;
     _encryptionService = encryptionService;
 }
Beispiel #8
0
 public ConditionRepository(
     PostgreSQLContextFactory <CampaignContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory;
     _mapper = mapper;
 }
 public WalletLinkingRequestsCounterRepository(
     PostgreSQLContextFactory <WalletLinkingContext> contextFactory,
     ILogFactory logFactory)
 {
     _contextFactory = contextFactory;
     _log            = logFactory.CreateLog(this);
 }
 public EmailVerificationCodeRepository(
     PostgreSQLContextFactory <AdminManagementContext> contextFactory,
     TimeSpan verificationLinkExpirePeriod)
 {
     _contextFactory = contextFactory;
     _verificationLinkExpirePeriod = verificationLinkExpirePeriod;
 }
Beispiel #11
0
 public OperationRequestsRepository(
     PostgreSQLContextFactory <PbfContext> contextFactory,
     ISqlRepositoryHelper sqlRepositoryHelper)
 {
     _contextFactory      = contextFactory;
     _sqlRepositoryHelper = sqlRepositoryHelper;
 }
 public NotificationMessageRepository(PostgreSQLContextFactory <DatabaseContext> msSqlContextFactory, IMapper mapper,
                                      ILogFactory logFactory)
 {
     _msSqlContextFactory = msSqlContextFactory;
     _mapper = mapper;
     _log    = logFactory.CreateLog(this);
 }
 public BonusTypeRepository(
     PostgreSQLContextFactory <CampaignContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory;
     _mapper = mapper;
 }
 public CustomerBonusesRepository(
     PostgreSQLContextFactory <DataContext> contextFactory,
     IMapper mapper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public EarnRuleContentRepository(
     PostgreSQLContextFactory <CampaignContext> msSqlContextFactory,
     IMapper mapper)
 {
     _msSqlContextFactory = msSqlContextFactory ??
                            throw new ArgumentNullException(nameof(msSqlContextFactory));
     _mapper = mapper;
 }
Beispiel #16
0
 public TransactionReportRepository(
     PostgreSQLContextFactory <ReportContext> contextFactory,
     IMapper mapper
     )
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public PartnerContactRepository(
     PostgreSQLContextFactory <CustomerProfileContext> contextFactory,
     IEncryptionService encryptionService,
     ILogFactory logFactory)
 {
     _contextFactory    = contextFactory;
     _encryptionService = encryptionService;
     _log = logFactory.CreateLog(this);
 }
Beispiel #18
0
 public PartnerCredentialsRepository(
     PostgreSQLContextFactory <CredentialsContext> contextFactory,
     IMapper mapper,
     Sha256HashingUtil hashingHelper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
     _hashingHelper  = hashingHelper;
 }
Beispiel #19
0
 public VouchersRepository(
     PostgreSQLContextFactory <DataContext> contextFactory,
     ILogFactory logFactory,
     IMapper mapper)
 {
     _contextFactory = contextFactory;
     _log            = logFactory.CreateLog(this);
     _mapper         = mapper;
 }
 public AdminProfileRepository(
     PostgreSQLContextFactory <CustomerProfileContext> contextFactory,
     IMapper mapper,
     IEncryptionService encryptionService)
 {
     _contextFactory    = contextFactory;
     _mapper            = mapper;
     _encryptionService = encryptionService;
 }
 public CustomerCredentialsRepository(
     PostgreSQLContextFactory <CredentialsContext> contextFactory,
     ILogFactory logFactory,
     Sha256HashingUtil hashingHelper)
 {
     _contextFactory = contextFactory;
     _hashingHelper  = hashingHelper;
     _log            = logFactory.CreateLog(this);
 }
        public CustomerProfileRepositoryTests()
        {
            var mapper = MapperHelper.CreateAutoMapper();

            var contextFixture = new BonusCustomerProfileContextFixture();

            var bonusCustomerProfileContext = contextFixture.BonusCustomerProfileContext;

            var msSqlContextFactory = new PostgreSQLContextFactory <BonusCustomerProfileContext>(
                dbCtxOptions => bonusCustomerProfileContext, contextFixture.DbContextOptions);

            _customerProfileRepository = new CustomerProfileRepository(msSqlContextFactory, mapper);
        }
Beispiel #23
0
        public CampaignRepositoryTest()
        {
            var mapper = MapperHelper.CreateAutoMapper();

            var contextFixture = new CampaignContextFixture();

            var bonusEngineContext = contextFixture.BonusEngineContext;

            var postgresContextFactory = new PostgreSQLContextFactory <CampaignContext>(
                dbCtx => bonusEngineContext, contextFixture.DbContextOptions);

            _campaignRepository = new CampaignRepository(postgresContextFactory, mapper);
        }
        public ABIRepository(
            PostgreSQLContextFactory <QeContext> contextFactory)
        {
            _contextFactory = contextFactory;

            _fetchCache = new CachedDataDictionary <string, ABI>(async() =>
            {
                using (var context = _contextFactory.CreateDataContext())
                {
                    var items = await context.ABIs.ToListAsync();

                    return(items
                           .Select(x => x.ToDto())
                           .ToDictionary(i => i.Abi));
                }
            });
        }
 public PartnersPaymentsRepository(PostgreSQLContextFactory <OperationsHistoryContext> contextFactory)
 {
     _contextFactory = contextFactory;
 }
Beispiel #26
0
 public PaymentProviderDetailsRepository(PostgreSQLContextFactory <CustomerProfileContext> contextFactory, IEncryptionService encryptionService)
 {
     _contextFactory    = contextFactory;
     _encryptionService = encryptionService;
 }
Beispiel #27
0
 public CurrencyRateRepository(PostgreSQLContextFactory <CurrencyContext> contextFactory, IMapper mapper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public NotificationRepository(PostgreSQLContextFactory <DataContext> contextFactory, IMapper mapper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public CountryPhoneCodeRepository(PostgreSQLContextFactory <DataContext> contextFactory, IMapper mapper)
 {
     _contextFactory = contextFactory;
     _mapper         = mapper;
 }
 public PaymentsRepository(PostgreSQLContextFactory <PartnersPaymentsContext> contextFactory)
 {
     _contextFactory = contextFactory;
 }