public CategoriesController( IAdminCategoryService adminCategoryService, ICategoryService categoryService) { this.adminCategoryService = adminCategoryService; this.categoryService = categoryService; }
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); }
public HomeController(ILogger <HomeController> logger, ICouponService couponService, IMenuItemService menuItemService, IAdminCategoryService categoryService) { _logger = logger; this.couponService = couponService; this.menuItemService = menuItemService; this.categoryService = categoryService; }
public AlbumsController( IAdminAlbumService albums, IAdminCategoryService categories) { this.albums = albums; this.categories = categories; }
public ModAdvertisementsController( IModeratorAdvertisementService advertisement, IAdminCategoryService category) { this.advertisement = advertisement; this.category = category; }
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; }
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)); }
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; }
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); }
public UsersController( IAdminCategoryService categories, IAdminUserService adminUsers, RoleManager <IdentityRole> roleManager, UserManager <User> userManager) { this.categories = categories; this.adminUsers = adminUsers; this.roleManager = roleManager; this.userManager = userManager; }
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); }
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); }
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; }
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."); }
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); }
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."); }
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); }
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); }
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."); } }
public CategoryController(IAdminCategoryService categoryService) { this._categoryService = categoryService; }
public CategoriesController(IAdminCategoryService adminCategoryService) { _adminCategoryService = adminCategoryService; }
public ModeratorProductService(TechShopDbContext db, IAdminCategoryService categories) { this.db = db; this.categories = categories; }
public AdminProductsController(IAdminProductService products, IAdminCategoryService categories) { this.products = products; this.categories = categories; }
public CategoriesController(UserManager <User> usermanager, IAdminCategoryService categories, IAdminCategoryService allCategories) { this.userManager = usermanager; this.categories = categories; this.allCategories = allCategories; }
public CategoriesController(IAdminCategoryService categoties) { this.categoties = categoties; }
public CategoriesController(IAdminCategoryService category) { this.category = category; }
public CategoriesController(IAdminCategoryService categoryService, IAdminBookService bookService) { this.categoryService = categoryService; this.bookService = bookService; }
public AdminCategoryController(IAdminCategoryService adminCategoryService, UserManager <AppUser> userManager) { _adminCategoryService = adminCategoryService; _userManager = userManager; }