Пример #1
0
 public CategoriesController(
     IAdminCategoryService adminCategoryService,
     ICategoryService categoryService)
 {
     this.adminCategoryService = adminCategoryService;
     this.categoryService      = categoryService;
 }
Пример #2
0
        public async Task ShowAsync_ShouldShowCategory()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            int id = context.Categories.First().Id;

            var category = context.Categories.First();

            category.IsDeleted = true;
            context.Categories.Update(category);
            await context.SaveChangesAsync();

            bool actualResult = await this.categoryService.ShowAsync(id);

            int expectedCount = 2;
            int actualCount   = context.Categories.Where(c => c.IsDeleted == false).Count();


            Assert.True(actualResult);
            Assert.True(expectedCount == actualCount);
        }
Пример #3
0
 public HomeController(ILogger <HomeController> logger, ICouponService couponService, IMenuItemService menuItemService, IAdminCategoryService categoryService)
 {
     _logger              = logger;
     this.couponService   = couponService;
     this.menuItemService = menuItemService;
     this.categoryService = categoryService;
 }
Пример #4
0
 public AlbumsController(
     IAdminAlbumService albums,
     IAdminCategoryService categories)
 {
     this.albums     = albums;
     this.categories = categories;
 }
 public ModAdvertisementsController(
     IModeratorAdvertisementService advertisement,
     IAdminCategoryService category)
 {
     this.advertisement = advertisement;
     this.category      = category;
 }
Пример #6
0
 public TopicsController(IAdminCategoryService categories, IForumTopicService topics, IHtmlService html, UserManager <User> userManager)
 {
     this.categories  = categories;
     this.topics      = topics;
     this.html        = html;
     this.userManager = userManager;
 }
 public MenuItemController(IWebHostEnvironment hostingEnv, IMenuItemService menuItemService, IAdminCategoryService categoryService, IAdminSubcategoryService subcategoryService)
 {
     this.hostingEnv         = hostingEnv;
     this.menuItemService    = menuItemService;
     this.categoryService    = categoryService;
     this.subcategoryService = subcategoryService;
     MenuItemVM = InitializeAsync().Result;
 }
Пример #8
0
 public UserTestController(IAdminTestService testsServices, IAdminCategoryService categories, IMappingProvider mapper, UserManager <User> userManager, IToastNotification toastr)
 {
     this.testsServices = testsServices ?? throw new ArgumentNullException(nameof(testsServices));
     this.categories    = categories ?? throw new ArgumentNullException(nameof(categories));
     this.mapper        = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.userManager   = userManager ?? throw new ArgumentNullException(nameof(userManager));
     this.toastr        = toastr ?? throw new ArgumentNullException(nameof(toastr));
 }
Пример #9
0
 public AdminProductsController(
     JjOnlineStoreDbContext context,
     IAdminProductsService adminProductsService,
     IAdminCategoryService adminCategoryService)
 {
     _context = context;
     _adminProductsService = adminProductsService;
     _adminCategoryService = adminCategoryService;
 }
 public AdvertisementsController(
     IAdvertisementService advertisement,
     IAdminCategoryService category,
     UserManager <User> userManager)
 {
     this.advertisement = advertisement;
     this.category      = category;
     this.userManager   = userManager;
 }
Пример #11
0
        public async Task GetAllCategories_WithoutData_ShouldReturnEmptyList()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            this.categoryService = new AdminCategoryService(context);

            List <AdminCategoryListingServiceModel> actualData = await this.categoryService.GetAllCategories().ToListAsync();

            Assert.Empty(actualData);
        }
Пример #12
0
 public UsersController(
     IAdminCategoryService categories,
     IAdminUserService adminUsers,
     RoleManager <IdentityRole> roleManager,
     UserManager <User> userManager)
 {
     this.categories  = categories;
     this.adminUsers  = adminUsers;
     this.roleManager = roleManager;
     this.userManager = userManager;
 }
Пример #13
0
        public async Task CreateAsync_ShouldCreateCategory()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            bool actualResult = await this.categoryService.CreateAsync("Изкуство");

            Assert.True(actualResult);
        }
Пример #14
0
        public async Task GetByIdAsync_WithNonExistentId_ShouldReturnNull()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            AdminCategoryListingServiceModel actualData = await this.categoryService.GetByIdAsync(-1);

            Assert.True(actualData == null);
        }
Пример #15
0
 public BooksController(IAdminBookService bookService,
                        IAdminAuthorService authorService,
                        IAdminPublisherService publisherService,
                        IAdminCategoryService categoryService,
                        ICloudinaryService cloudinaryService)
 {
     this.bookService       = bookService;
     this.authorService     = authorService;
     this.publisherService  = publisherService;
     this.categoryService   = categoryService;
     this.cloudinaryService = cloudinaryService;
 }
Пример #16
0
        public async Task GetByIdAsync_WithExistentId_ShouldReturnCorrectResult()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            AdminCategoryListingServiceModel expectedData = context.Categories.First().To <AdminCategoryListingServiceModel>();
            AdminCategoryListingServiceModel actualData   = await this.categoryService.GetByIdAsync(expectedData.Id);

            Assert.True(expectedData.Id == actualData.Id, "Id is not returned properly.");
            Assert.True(expectedData.Name == actualData.Name, "Name is not returned properly.");
        }
Пример #17
0
        public async Task HideAsync_WithNonExistentCategoryId_ShouldReturnFalse()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            bool actualResult = await this.categoryService.HideAsync(-1);

            int expectedCount = 2;
            int actualCount   = context.Categories.Where(c => c.IsDeleted == false).Count();

            Assert.False(actualResult);
            Assert.True(expectedCount == actualCount);
        }
Пример #18
0
        public async Task EditAsync_ShouldEditCategory()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            AdminCategoryListingServiceModel expectedData = context.Categories.First().To <AdminCategoryListingServiceModel>();

            expectedData.Name = "edited";

            await this.categoryService.EditAsync(expectedData.Id, expectedData.Name);

            AdminCategoryListingServiceModel actualData = context.Categories.First().To <AdminCategoryListingServiceModel>();

            Assert.True(actualData.Name == expectedData.Name, "Name not edited properly.");
        }
Пример #19
0
        public async Task HideAsync_ShouldHideCategory()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            int id = context.Categories.First().Id;

            bool actualResult = await this.categoryService.HideAsync(id);

            int expectedCount = 1;
            int actualCount   = context.Categories.Where(c => c.IsDeleted == true).Count();

            Assert.True(actualResult);
            Assert.True(expectedCount == actualCount);
        }
Пример #20
0
        public async Task ShowAsync_WithNonExistentCategoryId_ShouldReturnFalse()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            var category = context.Categories.First();

            category.IsDeleted = true;
            context.Categories.Update(category);
            await context.SaveChangesAsync();

            bool actualResult = await this.categoryService.ShowAsync(-1);

            int expectedCount = 1;
            int actualCount   = context.Categories.Where(c => c.IsDeleted == true).Count();

            Assert.False(actualResult);
            Assert.True(expectedCount == actualCount);
        }
Пример #21
0
        public async Task GetAllCategories_WithData_ShouldReturnAllCategories()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.categoryService = new AdminCategoryService(context);

            List <AdminCategoryListingServiceModel> expectedData = GetTestData()
                                                                   .To <AdminCategoryListingServiceModel>().ToList();

            List <AdminCategoryListingServiceModel> actualData = await this.categoryService.GetAllCategories().ToListAsync();

            Assert.Equal(expectedData.Count, actualData.Count);

            for (int i = 0; i < expectedData.Count; i++)
            {
                var expectedEntry = expectedData[i];
                var actualEntry   = actualData[i];

                Assert.True(expectedEntry.Name == actualEntry.Name, "Name is not returned properly.");
            }
        }
Пример #22
0
 public CategoryController(IAdminCategoryService categoryService)
 {
     this._categoryService = categoryService;
 }
Пример #23
0
 public CategoriesController(IAdminCategoryService adminCategoryService)
 {
     _adminCategoryService = adminCategoryService;
 }
Пример #24
0
 public ModeratorProductService(TechShopDbContext db, IAdminCategoryService categories)
 {
     this.db         = db;
     this.categories = categories;
 }
Пример #25
0
 public AdminProductsController(IAdminProductService products, IAdminCategoryService categories)
 {
     this.products   = products;
     this.categories = categories;
 }
Пример #26
0
 public CategoriesController(UserManager <User> usermanager, IAdminCategoryService categories, IAdminCategoryService allCategories)
 {
     this.userManager   = usermanager;
     this.categories    = categories;
     this.allCategories = allCategories;
 }
Пример #27
0
 public CategoriesController(IAdminCategoryService categoties)
 {
     this.categoties = categoties;
 }
 public CategoriesController(IAdminCategoryService category)
 {
     this.category = category;
 }
Пример #29
0
 public CategoriesController(IAdminCategoryService categoryService, IAdminBookService bookService)
 {
     this.categoryService = categoryService;
     this.bookService     = bookService;
 }
Пример #30
0
 public AdminCategoryController(IAdminCategoryService adminCategoryService,
                                UserManager <AppUser> userManager)
 {
     _adminCategoryService = adminCategoryService;
     _userManager          = userManager;
 }