示例#1
0
        public ProductPictureDboTest()
        {
            repository = new ProductPictureRepository(DbContextFactory);
            userRepository = new UserRepository(DbContextFactory);
            productRepository = new ProductRepository(DbContextFactory);

            dataService = new ProductPictureDataService(repository, UnitOfWork);
        }
示例#2
0
        public ProductPictureDboTest()
        {
            repository        = new ProductPictureRepository(DbContextFactory);
            userRepository    = new UserRepository(DbContextFactory);
            productRepository = new ProductRepository(DbContextFactory);

            dataService = new ProductPictureDataService(repository, UnitOfWork);
        }
示例#3
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context       = context;
     City           = new CityRepository(_context);
     Product        = new ProductRepository(_context);
     Address        = new AddressRepository(_context);
     Comment        = new CommentRepository(_context);
     Country        = new CountryRepository(_context);
     Email          = new EmailRepository(_context);
     PhoneNumber    = new PhoneNumberRepository(_context);
     ProductPicture = new ProductPictureRepository(_context);
     ProductType    = new ProductTypeRepository(_context);
     State          = new StateRepository(_context);
 }
示例#4
0
        public ECommerceUnitTests()
        {
            int.TryParse(ConfigurationManager.AppSettings["TwoFactorAuthTimeSpan"], out _twoFactorAuthTimeSpan);
            int.TryParse(ConfigurationManager.AppSettings["TwoFactorTimeOut"], out _twoFactorTimeOut);
            bool.TryParse(ConfigurationManager.AppSettings["TwoFactorEnabled"], out _twoFactorEnabled);
            _twoFactorAuthCookie    = ConfigurationManager.AppSettings["TwoFactorAuthCookie"];
            _twoFactorAuthSmtpHost  = ConfigurationManager.AppSettings["TwoFactorAuthSmtpHost"];
            _twoFactorAuthFromEmail = ConfigurationManager.AppSettings["TwoFactorAuthFromEmail"];
            _twoFactorAuthFromPhone = ConfigurationManager.AppSettings["TwoFactorAuthFromPhone"];
            _emailPassword          = ConfigurationManager.AppSettings["EmailPassword"];
            _authToken  = ConfigurationManager.AppSettings["TwilioAuthToken"];
            _accountSID = ConfigurationManager.AppSettings["TwilioAccountSID"];

            //Get payfabric configs
            _payfabricDeviceId       = ConfigurationManager.AppSettings["PayfabricDeviceId"];
            _payfabricDevicePassword = ConfigurationManager.AppSettings["PayfabricDevicePassword"];
            _payfabricDeviceUrl      = ConfigurationManager.AppSettings["PayfabricDeviceUrl"];


            var smsConfigs = new InitTwoFactor()
            {
                TwoFactorAuthTimeSpan  = _twoFactorAuthTimeSpan,
                TwoFactorAuthCookie    = _twoFactorAuthCookie,
                TwoFactorAuthSmtpHost  = _twoFactorAuthSmtpHost,
                TwoFactorAuthFromEmail = _twoFactorAuthFromEmail,
                TwoFactorAuthFromPhone = _twoFactorAuthFromPhone,
                AuthToken        = _authToken,
                AccountSID       = _accountSID,
                TwoFactorEnabled = _twoFactorEnabled,
                EmailPassword    = _emailPassword
            };

            _twoFactorAuth = new TwoFactorAuth(smsConfigs);

            //repositories
            var catalogSettings        = new CatalogSettings();
            var commonSettings         = new CommonSettings();
            var categoryRepository     = new CategoryRepository(connectionString);
            var productRepository      = new ProductRepository(connectionString);
            var productCategory        = new ProductCategoryMappingRepository(connectionString);
            var shoppingCartRepository = new ShoppingCartItemRepository(connectionString);

            var _pictureBinaryRepository = new PictureBinaryRepository(connectionString);
            var _pictureRepository       = new PictureRepository(connectionString);
            var _productAttributeCombinationRepository          = new ProductAttributeCombinationRepository(connectionString);
            var _productAttributeRepository                     = new ProductAttributeRepository(connectionString);
            var _productAttributeValueRepository                = new ProductAttributeValueRepository(connectionString);
            var _productAvailabilityRangeRepository             = new ProductAvailabilityRangeRepository(connectionString);
            var _productCategoryMappingRepository               = new ProductCategoryMappingRepository(connectionString);
            var _productProductAttributeMappingRepository       = new ProductProductAttributeMappingRepository(connectionString);
            var _productProductTagMappingRepository             = new ProductTagMappingRepository(connectionString);
            var _productSpecificationAttributeMappingRepository = new ProductSpecificationAttributeRepository(connectionString);
            var _specificationAttributeOptionRepository         = new SpecificationAttributeOptionRepository(connectionString);
            var _specificationAttributeRepository               = new SpecificationAttributeRepository(connectionString);
            var _productRepository = new ProductRepository(connectionString);
            var _productManufacturerMappingRepository = new ProductManufacturerMappingRepository(connectionString);
            var _productPictureRepository             = new ProductPictureRepository(connectionString);
            var _productReviewsRepository             = new ProductReviewsRepository(connectionString);
            var _tierPricesRepository                = new TierPricesRepository(connectionString);
            var _discountProductMappingRepository    = new DiscountProductMappingRepository(connectionString);
            var _productWarehouseInventoryRepository = new ProductWarehouseInventoryRepository(connectionString);
            var _customerRepository = new CustomerRepository(connectionString);

            //services
            _categoryService = new CategoryService(catalogSettings, commonSettings, categoryRepository, productRepository, productCategory);

            _menuService    = new MenuService(_categoryService);
            _cartService    = new CartService(commonSettings, shoppingCartRepository);
            _productService = new ProductService(
                _pictureBinaryRepository,
                _pictureRepository,
                _productAttributeCombinationRepository,
                _productAttributeRepository,
                _productAttributeValueRepository,
                _productAvailabilityRangeRepository,
                _productCategoryMappingRepository,
                _productProductAttributeMappingRepository,
                _productProductTagMappingRepository,
                _productSpecificationAttributeMappingRepository,
                _specificationAttributeOptionRepository,
                _specificationAttributeRepository,
                _productRepository,
                _productManufacturerMappingRepository,
                _productPictureRepository,
                _productReviewsRepository,
                _tierPricesRepository,
                _discountProductMappingRepository,
                _productWarehouseInventoryRepository
                );
            _customerService = new CustomerService(_customerRepository);
        }