Esempio n. 1
0
        public async Task SetUp()
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json")
                                .Build();

            var services = new ServiceCollection();

            services.AddTransient <IReflinkHelper, ReflinkHelper>();
            services.AddTransient <IUserAccountDataHelper, UserAccountDataHelper>();
            services.AddTransient <IMatrixPositionHelper, MatrixPositionHelper>();
            services.AddTransient <IUserMultiAccountHelper, UserMultiAccountHelper>();
            services.AddTransient <IPaymentHistoryHelper, PaymentHistoryHelper>();
            services.AddTransient <IUserAccountDataRepository, UserAccountDataRepository>();
            services.AddTransient <IUserMultiAccountRepository, UserMultiAccountRepository>();
            services.AddTransient <IMatrixPositionRepository, MatrixPositionRepository>();
            services.AddTransient <IPaymentHistoryRepository, PaymentHistoryRepository>();
            services.AddTransient <IArticleRepository, ArticleRepository>();
            services.AddTransient <ITicketRepository, TicketRepository>();
            services.AddTransient <IWithdrawalRepository, WithdrawalRepository>();
            services.Configure <JwtSettings>(configuration.GetSection("JwtSettings"));

            services.AddAutoMapper();
            services.AddMediatR(typeof(RegisterNewUserAccountCommand).Assembly);

            var connectionString = $@"Server=XARDASLORD\SQLEXPRESS;Database=BitClub7_integration_tests_{Guid.NewGuid()};Integrated Security=SSPI";

            services.AddDbContext <IBitClub7Context, BitClub7Context>(
                opts => opts.UseSqlServer(connectionString,
                                          b => b.MigrationsAssembly(typeof(IBitClub7Context).Namespace))
                );

            var serviceProvider = services.AddEntityFrameworkSqlServer()
                                  .BuildServiceProvider();

            _context                    = serviceProvider.GetRequiredService <IBitClub7Context>();
            _mapper                     = serviceProvider.GetRequiredService <IMapper>();
            _mediator                   = serviceProvider.GetRequiredService <IMediator>();
            _reflinkHelper              = serviceProvider.GetRequiredService <IReflinkHelper>();
            _userAccountDataHelper      = serviceProvider.GetRequiredService <IUserAccountDataHelper>();
            _matrixPositionHelper       = serviceProvider.GetRequiredService <IMatrixPositionHelper>();
            _userMultiAccountHelper     = serviceProvider.GetRequiredService <IUserMultiAccountHelper>();
            _paymentHistoryHelper       = serviceProvider.GetRequiredService <IPaymentHistoryHelper>();
            _userAccountDataRepository  = serviceProvider.GetRequiredService <IUserAccountDataRepository>();
            _userMultiAccountRepository = serviceProvider.GetRequiredService <IUserMultiAccountRepository>();
            _matrixPositionRepository   = serviceProvider.GetRequiredService <IMatrixPositionRepository>();
            _paymentHistoryRepository   = serviceProvider.GetRequiredService <IPaymentHistoryRepository>();
            _articleRepository          = serviceProvider.GetRequiredService <IArticleRepository>();
            _ticketRepository           = serviceProvider.GetRequiredService <ITicketRepository>();
            _withdrawalRepository       = serviceProvider.GetRequiredService <IWithdrawalRepository>();
            _jwtSettings                = serviceProvider.GetRequiredService <IOptions <JwtSettings> >();
            _bitBayPayApiSettings       = serviceProvider.GetRequiredService <IOptions <BitBayPayApiSettings> >();
            _matrixStructureSettings    = serviceProvider.GetRequiredService <IOptions <MatrixStructureSettings> >();
            _storageSettings            = serviceProvider.GetRequiredService <IOptions <StorageSettings> >();

            _context.Database.Migrate();
            await ClearDatabase();
        }
 public RegisterNewUserAccountCommandHandler(
     IBitClub7Context context,
     IUserMultiAccountHelper userMultiAccountHelper,
     IUserMultiAccountRepository userMultiAccountRepository)
 {
     _context = context;
     _userMultiAccountHelper     = userMultiAccountHelper;
     _userMultiAccountRepository = userMultiAccountRepository;
 }
Esempio n. 3
0
 public CreateMultiAccountCommandHandler(
     IBitClub7Context context,
     IUserAccountDataRepository userAccountDataRepository,
     IUserMultiAccountRepository userMultiAccountRepository,
     IMatrixPositionRepository matrixPositionRepository,
     IUserMultiAccountHelper userMultiAccountHelper,
     IMatrixPositionHelper matrixPositionHelper)
 {
     _context = context;
     _userAccountDataRepository  = userAccountDataRepository;
     _userMultiAccountRepository = userMultiAccountRepository;
     _matrixPositionRepository   = matrixPositionRepository;
     _userMultiAccountHelper     = userMultiAccountHelper;
     _matrixPositionHelper       = matrixPositionHelper;
 }
 public UserMultiAccountRepository(IBitClub7Context context)
 {
     _context = context;
 }
 public UserAccountDataRepository(IBitClub7Context context)
 {
     _context = context;
 }
 public PaymentHistoryRepository(IBitClub7Context context)
 {
     _context = context;
 }
Esempio n. 7
0
 public MatrixPositionHasBeenUpgradedJob(IBitClub7Context context, IMatrixPositionRepository matrixPositionRepository)
 {
     _context = context;
     _matrixPositionRepository = matrixPositionRepository;
 }
Esempio n. 8
0
 public MatrixPositionHelper(IBitClub7Context context, IMatrixPositionRepository matrixPositionRepository, IUserMultiAccountRepository userMultiAccountRepository)
 {
     _context = context;
     _matrixPositionRepository   = matrixPositionRepository;
     _userMultiAccountRepository = userMultiAccountRepository;
 }
Esempio n. 9
0
 public TicketRepository(IBitClub7Context context)
 {
     _context = context;
 }
Esempio n. 10
0
 public ArticleRepository(IBitClub7Context context)
 {
     _context = context;
 }
Esempio n. 11
0
 public WithdrawalRepository(IBitClub7Context context)
 {
     _context = context;
 }
Esempio n. 12
0
 public MatrixPositionRepository(IBitClub7Context context)
 {
     _context = context;
 }
 public MatrixPositionHasBeenBoughtEventHandler(IBitClub7Context context, IMatrixPositionRepository matrixPositionRepository)
 {
     _context = context;
     _matrixPositionRepository = matrixPositionRepository;
 }
Esempio n. 14
0
 public UserMultiAccountHelper(IBitClub7Context context, IUserAccountDataRepository userAccountDataRepository)
 {
     _context = context;
     _userAccountDataRepository = userAccountDataRepository;
 }