Example #1
0
 public UnitOfWork(WALLETContext context)
 {
     _context          = context;
     Users             = new UserRepository(_context);
     Transactions      = new TransactionRepository(_context);
     FixedTermDeposits = new FixedTermDepositRepository(_context);
     Accounts          = new AccountRepository(_context);
     TransactionLog    = new TransactionLogRepository(_context);
     Rates             = new RatesRepository(_context);
     RefundRequest     = new RefundRequestRepository(_context);
     Transfers         = new TransfersRepository(_context);
     EmailTemplates    = new EmailTemplatesRepository(_context);
 }
Example #2
0
        public TestBase(int userId = 1)
        {
            // Set appsettings configuration
            _configuration = new ConfigurationBuilder()
                             .AddJsonFile("appsettings.test.json")
                             .Build();
            // Set Mock identity
            _identity          = new ClaimsIdentity();
            _user              = new ClaimsPrincipal(_identity);
            _controllerContext = new ControllerContext {
                HttpContext = new DefaultHttpContext {
                    User = _user
                }
            };
            _identity.AddClaims(new[]
            {
                new Claim("UserId", userId.ToString()),
            });
            // Set Database in memory
            context = new WALLETContext(GetDbOptionsBuilder().Options);
            DataInitializer.Initialize(context);

            // Set Unit of Work
            _unitOfWork = new UnitOfWork(context);

            // Set account businness
            _accountBusiness = new AccountBusiness(_unitOfWork);

            // Set rates
            _ratesBusiness = new RatesBusiness(_unitOfWork, _mapper);

            // Set Mapper
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new AutoMapperProfile());
            });

            _mapper = mappingConfig.CreateMapper();
        }
Example #3
0
 public AccountRepository(WALLETContext context) : base(context)
 {
 }
 public UserRepository(WALLETContext context) : base(context)
 {
 }
Example #5
0
 public EmailTemplatesRepository(WALLETContext context) : base(context)
 {
 }
Example #6
0
 public RefundRequestRepository(WALLETContext context) : base(context)
 {
 }
 public FixedTermDepositRepository(WALLETContext context) : base(context)
 {
 }
 public TransactionRepository(WALLETContext context) : base(context)
 {
 }
Example #9
0
 public TransfersRepository(WALLETContext context) : base(context)
 {
 }
 public GenericRepository(WALLETContext context)
 {
     _context = context;
 }
Example #11
0
 public RatesRepository(WALLETContext context) : base(context)
 {
 }