Esempio n. 1
0
        public async Task TestIfBasicFiltersExistForCategoryReturnsTrue(string categoryName)
        {
            var context        = PCHUBDbContextInMemoryInitializer.InitializeContext();
            var filtersService = new Areas.Administration.Services.AdminFiltersServices(context);

            var form = new InsertBasicFiltersViewModel();

            form.Category = categoryName;

            await filtersService.CreateBasicFiltersAsync(form);

            Assert.True(await filtersService.BasicFiltersExistForCategoryAsync(categoryName));
        }
Esempio n. 2
0
        public async Task TestIfCreateBasicFiltersWorksAccordingly(string categoryName)
        {
            var context        = PCHUBDbContextInMemoryInitializer.InitializeContext();
            var filtersService = new Areas.Administration.Services.AdminFiltersServices(context);

            var form = new InsertBasicFiltersViewModel();

            form.Category = categoryName;

            await filtersService.CreateBasicFiltersAsync(form);

            var result = await context.FilterCategories.FirstOrDefaultAsync(x => x.CategoryName == categoryName);

            Assert.NotNull(result);

            Assert.Contains(result.Filters, x => x.Value != null);
        }