public CategoriesControllerTests()
        {
            this.dbContext     = MockDbContext.GetContext();
            this.configuration = new ConfigurationBuilder()
                                 .AddJsonFile("settings.json")
                                 .Build();

            this.restaurantImagesRepository = new EfDeletableEntityRepository <RestaurantImage>(this.dbContext);
            this.categoryImageRepository    = new EfDeletableEntityRepository <CategoryImage>(this.dbContext);
            this.restaurantRepository       = new EfDeletableEntityRepository <Restaurant>(this.dbContext);
            this.categoryRepository         = new EfDeletableEntityRepository <Category>(this.dbContext);
            this.favouriteRepository        = new EfRepository <FavouriteRestaurant>(this.dbContext);
            this.voteRepository             = new EfRepository <Vote>(this.dbContext);
            this.commentRepository          = new EfDeletableEntityRepository <Comment>(this.dbContext);

            this.voteService             = new VoteService(this.voteRepository);
            this.commentService          = new CommentService(this.commentRepository, this.voteService);
            this.cloudinaryService       = new CloudinaryImageService(this.configuration);
            this.restaurantImagesService = new RestaurantImageService(this.restaurantImagesRepository, this.cloudinaryService);
            this.restaurantService       = new RestaurantService(this.restaurantRepository, this.restaurantImagesService, this.commentService);

            this.categoryImageService = new CategoryImageService(this.categoryImageRepository, this.cloudinaryService);
            this.categoryService      = new CategoryService(this.categoryRepository, this.categoryImageService, this.restaurantService);
            this.favouriteService     = new FavouriteService(this.favouriteRepository);

            var httpContext = new DefaultHttpContext();
            var tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            this.controller = new CategoriesController(this.categoryService, this.restaurantService, this.favouriteService)
            {
                TempData = tempData,
            };

            AutoMapperConfig.RegisterMappings(typeof(ErrorViewModel).Assembly);
        }
Пример #2
0
 public CategoryService(
     IDeletableEntityRepository <Category> categoriesRepository,
     ICategoryImageService imageService,
     IRestaurantService restaurantService)
 {
     this.categoriesRepository = categoriesRepository;
     this.imageService         = imageService;
     this.restaurantService    = restaurantService;
 }
 public ManagementPanelController(IPageService pageService, ISettingService settingService, ISocialService socialService, ISliderService sliderService, IGalleryService galleryService, ICategoryImageService categoryImageService, IGalleryCategoryService galleryCategoryService, UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, IWebHostEnvironment hostingEnvironment)
 {
     _pageService            = pageService;
     _settingService         = settingService;
     _socialService          = socialService;
     _sliderService          = sliderService;
     _galleryService         = galleryService;
     _categoryImageService   = categoryImageService;
     _galleryCategoryService = galleryCategoryService;
     _userManager            = userManager;
     _signInManager          = signInManager;
     _hostingEnvironment     = hostingEnvironment;
 }
 public GalleryPageCategoryViewComponent(ICategoryImageService categoryImageService)
 {
     _categoryImageService = categoryImageService;
 }