public WeatherForecastController(IServiceHandlerFactory ServiceHandlerFactory , ISubCategoriesService SubCategoriesService , ILogger <WeatherForecastController> logger) { _logger = logger; _SubCategoriesService = SubCategoriesService; _ServiceHandlerFactory = ServiceHandlerFactory; }
public SubCategoriesController( ISubCategoriesService subCategoriesService, IArticlesService articleService, IPagingService pagingService) { this.subCategoriesService = subCategoriesService; this.articleService = articleService; this.pagingService = pagingService; }
public SubCategoriesController( ISubCategoriesService subCategoriesService, IPagingService pagingService, ICategoriesService categoriesService) { this.subCategoriesService = subCategoriesService; this.pagingService = pagingService; this.categoriesService = categoriesService; }
public ArticleController( IArticlesService articleService, ICategoriesService categoriesService, ISubCategoriesService subCategoriesService, IPagingService pagingService, UserManager <ApplicationUser> userManager) { this.articleService = articleService; this.categoriesService = categoriesService; this.subCategoriesService = subCategoriesService; this.pagingService = pagingService; this.userManager = userManager; }
public AdsService(SellMeDbContext context, IAddressesService addressesService, IUsersService usersService, ICategoriesService categoriesService, IUpdatesService updatesService, ISubCategoriesService subCategoriesService, IMapper mapper, ICloudinaryService cloudinaryService) { this.context = context; this.addressesService = addressesService; this.usersService = usersService; this.categoriesService = categoriesService; this.updatesService = updatesService; this.subCategoriesService = subCategoriesService; this.mapper = mapper; this.cloudinaryService = cloudinaryService; }
public async Task GetSubcategoriesByCategoryIdAsync_WithInvalidCategoryId_ShouldThrowAndInvalidArgumentException() { //Arrange var expectedErrorMessage = "Category with the given id doesn't exist!"; var context = InitializeContext.CreateContextForInMemory(); subcategoriesService = new SubCategoriesService(context); //Act and assert var ex = await Assert.ThrowsAsync <ArgumentException>(() => subcategoriesService.GetSubcategoriesByCategoryIdAsync(1)); Assert.Equal(expectedErrorMessage, ex.Message); }
public MealsController( UserManager <ApplicationUser> userManager, ICategoriesService categoriesService, ISubCategoriesService subCategoriesService, IMealService mealService, IWebHostEnvironment environment, IEmailSender emailSender, IViewRenderService viewRenderService, IUsersService usersService) { this.userManager = userManager; this.categoriesService = categoriesService; this.subCategoriesService = subCategoriesService; this.mealService = mealService; this.environment = environment; this.emailSender = emailSender; this.viewRenderService = viewRenderService; this.usersService = usersService; }
public SubCategoriesController(IUniStoreContext context, ISubCategoriesService service, User user) : base(context, user) { this.service = service; }
public SubCategoriesController(ISubCategoriesService subCategoriesService) { _subCategoriesService = subCategoriesService; }
public AdsController(IAdsService adService, ISubCategoriesService subCategoriesService) { this.adService = adService; this.subCategoriesService = subCategoriesService; }
public SubCategoriesController(ISubCategoriesService subCategoriesService, ILogger <SubCategoriesController> logger) { _logger = logger; _subCategoriesService = subCategoriesService; }
public async Task GetSubcategoriesByCategoryIdAsync_WithValidData_ShouldReturnCorrectResult() { //Arrange var expected = new List <CreateAdSubcategoryViewModel> { new CreateAdSubcategoryViewModel { Id = 1, Name = "Phones" }, new CreateAdSubcategoryViewModel { Id = 2, Name = "Displays" } }; var context = InitializeContext.CreateContextForInMemory(); subcategoriesService = new SubCategoriesService(context); var testSubcategories = new List <SubCategory> { new SubCategory { Id = 1, CategoryId = 1, Name = "Phones" }, new SubCategory { Id = 2, CategoryId = 1, Name = "Displays" } }; var testCategory = new Category { Id = 1, Name = "Electronics" }; await context.Categories.AddAsync(testCategory); await context.SubCategories.AddRangeAsync(testSubcategories); await context.SaveChangesAsync(); //Act var actual = await subcategoriesService.GetSubcategoriesByCategoryIdAsync(1); Assert.Collection(actual, elem1 => { Assert.Equal(expected[0].Id, elem1.Id); Assert.Equal(expected[0].Name, elem1.Name); }, elem2 => { Assert.Equal(expected[1].Id, elem2.Id); Assert.Equal(expected[1].Name, elem2.Name); }); Assert.Equal(expected.Count, actual.Count); }