Beispiel #1
0
        public async Task SubCategoryExists_OnNonExistingSubCategory_ShouldReturnTrue()
        {
            string onTrueErrorMessage = "The method returned true on non-existing sub-category.";

            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            var subCategoryService = new SubCategoryService(context);

            string nonExistingSubCategoryName = "fakeSubCategoryId";

            var methodResult = await subCategoryService.SubCategoryExists(nonExistingSubCategoryName);

            Assert.False(methodResult, onTrueErrorMessage);
        }
Beispiel #2
0
        public async Task SubCategoryExists_OnExistingSubCategory_ShouldReturnTrue()
        {
            string onFalseErrorMessage = "The method returned false on existing sub-category.";

            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            var subCategoryService = new SubCategoryService(context);

            // Seeding multiple categories with sub-categories
            var expectedSubCategories = await this.SeedAndGetSubCategoriesWithCategories(context);

            string existingSubCategoryName = "A-SubCategory-forSecond";

            var methodResult = await subCategoryService.SubCategoryExists(existingSubCategoryName);

            Assert.True(methodResult, onFalseErrorMessage);
        }