public void Setup()
        {
            _dbSetUpHelper = new DatabaseSetUpHelper();
            _context       = _dbSetUpHelper.GetContext();

            _paymentsRepository     = new PaymentsRepository(_context);
            _userPaymentsRepository = new UserPaymentsRepository(_context);
            _flatRepository         = new FlatRepository(_context);
            _userRepository         = new UserRepository(_context);

            _mapperHelper = new MapperHelper();
            var mapper = _mapperHelper.GetMapper();

            DefaultHttpContext httpContext = new DefaultHttpContext();
            GenericIdentity    MyIdentity  = new GenericIdentity("User");
            ClaimsIdentity     objClaim    = new ClaimsIdentity(new List <Claim> {
                new Claim(ClaimTypes.NameIdentifier, "1")
            });

            _paymentsController = new PaymentsController(_paymentsRepository, _userPaymentsRepository, _flatRepository, _userRepository, mapper)
            {
                ControllerContext = new ControllerContext()
            };
            _paymentsController.ControllerContext.HttpContext = httpContext;
            httpContext.User = new ClaimsPrincipal(objClaim);
        }
        public void Setup()
        {
            _dbSetUpHelper     = new DatabaseSetUpHelper();
            _context           = _dbSetUpHelper.GetContext();
            _httpContextHelper = new HttpContextHelper();

            _choresRepository = new ChoresRepository(_context);
            _flatRepository   = new FlatRepository(_context);
            _userRepository   = new UserRepository(_context);

            _mapperHelper = new MapperHelper();
            var mapper = _mapperHelper.GetMapper();

            var httpContext = _httpContextHelper.GetHttpContext();
            var objClaim    = _httpContextHelper.GetClaimsIdentity();

            _choreController = new ChoreController(_choresRepository, _flatRepository, _userRepository, mapper)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = httpContext
                }
            };
            httpContext.User = new ClaimsPrincipal(objClaim);
        }
        public void Setup()
        {
            _dbSetUpHelper   = new DatabaseSetUpHelper();
            _serviceProvider = _dbSetUpHelper.GetServiceDependencyResolver();
            _context         = _dbSetUpHelper.GetContext();

            _userController = new UserController(_serviceProvider.GetService <IOptions <AppSettings> >(), _context);
        }
Пример #4
0
        public void Setup()
        {
            _dbSetUpHelper   = new DatabaseSetUpHelper();
            _serviceProvider = _dbSetUpHelper.GetServiceDependencyResolver();
            _context         = _dbSetUpHelper.GetContext();

            _paymentsRepository     = new PaymentsRepository(_context);
            _userPaymentsRepository = new UserPaymentsRepository(_context);
            _flatRepository         = new FlatRepository(_context);
            _userRepository         = new UserRepository(_context);

            // ISSUE: controller takes in IMapper, but no way of instantiating
            _paymentsController = new PaymentsController(_paymentsRepository, _userPaymentsRepository, _flatRepository, _userRepository, null);
        }
Пример #5
0
        public void Setup()
        {
            _dbSetUpHelper     = new DatabaseSetUpHelper();
            _context           = _dbSetUpHelper.GetContext();
            _httpContextHelper = new HttpContextHelper();

            var httpContext = _httpContextHelper.GetHttpContext();
            var objClaim    = _httpContextHelper.GetClaimsIdentity();

            _flatController = new FlatController(_context)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = httpContext
                }
            };
            httpContext.User = new ClaimsPrincipal(objClaim);
        }
        public void Setup()
        {
            _dbSetUpHelper   = new DatabaseSetUpHelper();
            _serviceProvider = _dbSetUpHelper.GetServiceDependencyResolver();
            _context         = _dbSetUpHelper.GetContext();

            _httpContextHelper = new HttpContextHelper();
            var httpContext = _httpContextHelper.GetHttpContext();
            var objClaim    = _httpContextHelper.GetClaimsIdentity();

            _userController = new UserController(_serviceProvider.GetService <IOptions <AppSettings> >(), _context)
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = httpContext
                }
            };
            httpContext.User = new ClaimsPrincipal(objClaim);
        }
 public void Setup()
 {
     _dbSetUpHelper   = new DatabaseSetUpHelper();
     _serviceProvider = _dbSetUpHelper.GetServiceDependencyResolver();
     _context         = _dbSetUpHelper.GetContext();
 }