예제 #1
0
        public void Setup()
        {
            _existigCategories = new List <Category>();

            for (int i = 0; i < 1000; i++)
            {
                _existigCategories.Add(new Category()
                {
                    Id = i + 1
                });
            }

            _existigCategories[5].Deleted    = true;
            _existigCategories[51].Published = false;
            _existigCategories = _existigCategories.OrderBy(x => x.Id).ToList();

            var categoryRepo = MockRepository.GenerateStub <IRepository <Category> >();

            categoryRepo.Stub(x => x.TableNoTracking).Return(_existigCategories.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            _categoryApiService = new CategoryApiService(categoryRepo, productCategoryRepo, storeMappingService);
        }
        public async Task <IActionResult> AssignCategory(int id, [FromServices] ICategoryApiService categoryApiService)
        {
            TempData["active"] = "blog";

            var categories = await categoryApiService.GetAllAsync();

            var blogCategories = await _blogApiService.GetCategories(id);

            TempData["blogId"] = id;

            List <AssignCategoryModel> list = new List <AssignCategoryModel>();

            foreach (var category in categories)
            {
                AssignCategoryModel model = new AssignCategoryModel();

                model.CategoryId   = category.Id;
                model.CategoryName = category.Name;
                model.Exists       = blogCategories.Contains(category);

                list.Add(model);
            }

            return(View(list));
        }
        public void TestInitialize()
        {
            Mongodb.IgnoreExtraElements();
            Mapper.Run();
            var mongo = Mongodb.MongoDbClient();

            _mongoDBContext = new MongoDBContext(mongo.client, mongo.database);

            InitCategoryRepo();

            var categoryService = new Mock <ICategoryService>();

            _categoryService = categoryService.Object;


            var urlRecordService = new Mock <IUrlRecordService>();

            _urlRecordService = urlRecordService.Object;

            var pictureService = new Mock <IPictureService>();

            _pictureService = pictureService.Object;

            var localizationService = new Mock <ILocalizationService>();

            _localizationService = localizationService.Object;

            var customerActivityService = new Mock <ICustomerActivityService>();

            _customerActivityService = customerActivityService.Object;

            _categoryApiService = new CategoryApiService(_mongoDBContext, _categoryService, _urlRecordService, _pictureService, _customerActivityService, _localizationService);
        }
예제 #4
0
 public WebHookEventConsumer(IStoreService storeService)
 {
     _customerApiService    = EngineContext.Current.Resolve <ICustomerApiService>();
     _categoryApiService    = EngineContext.Current.Resolve <ICategoryApiService>();
     _productApiService     = EngineContext.Current.Resolve <IProductApiService>();
     _dtoHelper             = EngineContext.Current.Resolve <IDTOHelper>();
     _productPictureService = EngineContext.Current.Resolve <IProductPictureService>();
     _productService        = EngineContext.Current.Resolve <IProductService>();
     _categoryService       = EngineContext.Current.Resolve <ICategoryService>();
     _storeMappingService   = EngineContext.Current.Resolve <IStoreMappingService>();
     _cacheManager          = EngineContext.Current.Resolve <IStaticCacheManager>();
 }
        public void Setup()
        {
            _baseDate = new DateTime(2016, 2, 23);

            _existigCategories = new List <Category>()
            {
                new Category()
                {
                    Id = 2, CreatedOnUtc = _baseDate.AddMonths(2)
                },
                new Category()
                {
                    Id = 3, CreatedOnUtc = _baseDate.AddMonths(10)
                },
                new Category()
                {
                    Id = 1, CreatedOnUtc = _baseDate.AddMonths(7)
                },
                new Category()
                {
                    Id = 4, CreatedOnUtc = _baseDate
                },
                new Category()
                {
                    Id = 5, CreatedOnUtc = _baseDate.AddMonths(3)
                },
                new Category()
                {
                    Id = 6, Deleted = true, CreatedOnUtc = _baseDate.AddMonths(10)
                },
                new Category()
                {
                    Id = 7, Published = false, CreatedOnUtc = _baseDate.AddMonths(4)
                }
            };

            var categoryRepo = MockRepository.GenerateStub <IRepository <Category> >();

            categoryRepo.Stub(x => x.TableNoTracking).Return(_existigCategories.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            storeMappingService.Stub(x => x.Authorize(Arg <Category> .Is.Anything)).Return(true);

            _categoryApiService = new CategoryApiService(categoryRepo, productCategoryRepo, storeMappingService);
        }
        public void Setup()
        {
            _existigCategories = new List <Category>()
            {
                new Category()
                {
                    Id = 2, Published = true
                },
                new Category()
                {
                    Id = 3, Published = true
                },
                new Category()
                {
                    Id = 1, Published = false
                },
                new Category()
                {
                    Id = 4, Published = true
                },
                new Category()
                {
                    Id = 5, Published = true
                },
                new Category()
                {
                    Id = 6, Deleted = true, Published = true
                },
                new Category()
                {
                    Id = 7, Published = false
                }
            };

            var categoryRepo = MockRepository.GenerateStub <IRepository <Category> >();

            categoryRepo.Stub(x => x.TableNoTracking).Return(_existigCategories.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            storeMappingService.Stub(x => x.Authorize(Arg <Category> .Is.Anything)).Return(true);

            _categoryApiService = new CategoryApiService(categoryRepo, productCategoryRepo, storeMappingService);
        }
        public WebHookEventConsumer(IStoreService storeService)
        {
            IWebHookService webHookService = EngineContext.Current.ContainerManager.Resolve <IWebHookService>();

            _customerApiService = EngineContext.Current.ContainerManager.Resolve <ICustomerApiService>();
            _categoryApiService = EngineContext.Current.ContainerManager.Resolve <ICategoryApiService>();
            _productApiService  = EngineContext.Current.ContainerManager.Resolve <IProductApiService>();
            _dtoHelper          = EngineContext.Current.ContainerManager.Resolve <IDTOHelper>();
            _storeService       = EngineContext.Current.ContainerManager.Resolve <IStoreService>();

            _productService      = EngineContext.Current.ContainerManager.Resolve <IProductService>();
            _categoryService     = EngineContext.Current.ContainerManager.Resolve <ICategoryService>();
            _storeMappingService = EngineContext.Current.ContainerManager.Resolve <IStoreMappingService>();
            _storeContext        = EngineContext.Current.ContainerManager.Resolve <IStoreContext>();

            _webHookManager = webHookService.GetHookManager();
        }
예제 #8
0
        public void Setup()
        {
            _baseDate = new DateTime(2016, 2, 12);

            _existigCategories = new List <Category>()
            {
                new Category()
                {
                    Id = 2, UpdatedOnUtc = _baseDate.AddMonths(2)
                },
                new Category()
                {
                    Id = 3, UpdatedOnUtc = _baseDate.AddMonths(6)
                },
                new Category()
                {
                    Id = 1, UpdatedOnUtc = _baseDate.AddMonths(7)
                },
                new Category()
                {
                    Id = 4, UpdatedOnUtc = _baseDate
                },
                new Category()
                {
                    Id = 5, UpdatedOnUtc = _baseDate.AddMonths(3)
                },
                new Category()
                {
                    Id = 6, Deleted = true, UpdatedOnUtc = _baseDate.AddMonths(10)
                },
                new Category()
                {
                    Id = 7, Published = false, UpdatedOnUtc = _baseDate.AddMonths(4)
                }
            };

            var categoryRepo = MockRepository.GenerateStub <IRepository <Category> >();

            categoryRepo.Stub(x => x.TableNoTracking).Return(_existigCategories.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            _categoryApiService = new CategoryApiService(categoryRepo, productCategoryRepo);
        }
        public void Setup()
        {
            _existigCategories = new List <Category>()
            {
                new Category()
                {
                    Id = 2
                },
                new Category()
                {
                    Id = 3
                },
                new Category()
                {
                    Id = 1
                },
                new Category()
                {
                    Id = 4
                },
                new Category()
                {
                    Id = 5
                },
                new Category()
                {
                    Id = 6, Deleted = true
                },
                new Category()
                {
                    Id = 7
                }
            };

            var categoryRepo = MockRepository.GenerateStub <IRepository <Category> >();

            categoryRepo.Stub(x => x.TableNoTracking).Return(_existigCategories.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            _categoryApiService = new CategoryApiService(categoryRepo, productCategoryRepo, storeMappingService);
        }
예제 #10
0
 public ProductCategoryMappingsController(IProductCategoryMappingsApiService productCategoryMappingsService,
                                          ICategoryService categoryService,
                                          IJsonFieldsSerializer jsonFieldsSerializer,
                                          IAclService aclService,
                                          ICustomerService customerService,
                                          IStoreMappingService storeMappingService,
                                          IStoreService storeService,
                                          IDiscountService discountService,
                                          ICustomerActivityService customerActivityService,
                                          ILocalizationService localizationService,
                                          ICategoryApiService categoryApiService,
                                          IProductApiService productApiService)
     : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService)
 {
     _productCategoryMappingsService = productCategoryMappingsService;
     _categoryService    = categoryService;
     _categoryApiService = categoryApiService;
     _productApiService  = productApiService;
 }
예제 #11
0
 public CategoriesController(ICategoryApiService categoryApiService,
                             IJsonFieldsSerializer jsonFieldsSerializer,
                             ICategoryService categoryService,
                             IUrlRecordService urlRecordService,
                             ICustomerActivityService customerActivityService,
                             ILocalizationService localizationService,
                             IPictureService pictureService,
                             IStoreMappingService storeMappingService,
                             IStoreService storeService,
                             IDiscountService discountService,
                             IAclService aclService,
                             ICustomerService customerService,
                             IFactory <Category> factory) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService)
 {
     _categoryApiService = categoryApiService;
     _categoryService    = categoryService;
     _urlRecordService   = urlRecordService;
     _factory            = factory;
     _pictureService     = pictureService;
 }
        public void TestInitialize()
        {
            Mongodb.IgnoreExtraElements();
            InitCategoryRepo();
            var tempCategoryApiService = new Mock <ICategoryApiService>();
            {
                tempCategoryApiService.Setup(instance => instance.GetCategories()).Returns(_categoryDto.AsQueryable());
                tempCategoryApiService.Setup(instance => instance.GetById(_id1)).ReturnsAsync(_categoryDto.AsQueryable().FirstOrDefault(x => x.Id == _id1));
                tempCategoryApiService.Setup(instance => instance.InsertOrUpdateCategory(modelInsertOrUpdate)).ReturnsAsync(InsertOrUpdate(modelInsertOrUpdate));

                _categoryApiService = tempCategoryApiService.Object;
            }
            var tempPermissionService = new Mock <IPermissionService>();

            {
                tempPermissionService.Setup(instance => instance.Authorize(PermissionSystemName.Categories)).ReturnsAsync(true);
                _permissionService = tempPermissionService.Object;
            }
            _categoryController = new CategoryController(_categoryApiService, _permissionService);
        }
예제 #13
0
        public async Task <IActionResult> AssignCategory(int id, [FromServices] ICategoryApiService categoryApiService)
        {
            TempData["active"] = "blog";
            var categories = await categoryApiService.GetAllCategoriesAsync();

            var blogCategory = (await _blogApiService.GetAllCategories(id)).Select(i => i.Name).ToList();

            TempData["blogid"] = id;
            List <AssignCategoryModel> models = new List <AssignCategoryModel>();

            foreach (var category in categories)
            {
                AssignCategoryModel model2 = new AssignCategoryModel();
                model2.CategoryId   = category.Id;
                model2.CategoryName = category.Name;
                model2.Exits        = blogCategory.Contains(category.Name);

                models.Add(model2);
            }

            return(View(models));
        }
예제 #14
0
        public async Task <IActionResult> AssignCategory(int id,
                                                         [FromServices] ICategoryApiService categoryApiService)
        {
            TempData["active"] = "topic";
            var categories = await categoryApiService.GetAllAsync();

            var topicCategories = (await _topicApiService.GetCategoriesAsync(id));

            TempData["topicId"] = id;

            List <AssignCategoryModel> list = new List <AssignCategoryModel>();

            foreach (var item in categories)
            {
                AssignCategoryModel model = new AssignCategoryModel();
                model.CategoryId   = item.Id;
                model.CategoryName = item.Name;
                model.Exist        = topicCategories.Contains(item);

                list.Add(model);
            }

            return(View(list));
        }
예제 #15
0
 public GetCategoryName(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
예제 #16
0
 public CategoryController(ICategoryApiService categoryApiService, IPermissionService permissionService)
 {
     _categoryApiService = categoryApiService;
     _permissionService  = permissionService;
 }
 public CategoryNameTagHelper(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
 public CategoryListViewModel(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
예제 #19
0
 public CategoryList(ICategoryApiService service)
 {
     _service = service;
 }
예제 #20
0
 public HomeController(IBlogApiService blogApiService, ICategoryApiService categoryApiService)
 {
     _blogApiService     = blogApiService;
     _categoryApiService = categoryApiService;
 }
예제 #21
0
 public CategoryComponent(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
 public CategoryList(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
예제 #23
0
 public CategoryFilterTagHelper(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
 public CategoriesController(ICategoryApiService categoryApiService)
 {
     _categoryApiService = categoryApiService;
 }
예제 #25
0
 public CategoryService(ICategoryApiService apiService)
 {
 }