コード例 #1
0
        public async Task GetDeletableSubCategories_WithNoSubCategories_ShouldReturnAnEmptyCollection()
        {
            string onCountDiferenceErrorMessage = "The method did not return an empty collection.";

            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            var subCategoryService = new SubCategoryService(context);

            var methodResult = await subCategoryService.GetDeletableSubCategories();

            var expectedCount = 0;

            AssertExtensions.EqualCountWithMessage(expectedCount, methodResult.Count(), onCountDiferenceErrorMessage);
        }
コード例 #2
0
        public async Task GetDeletableSubCategories_WithDeletableSubCategories_ShouldReturnCorrectCollection()
        {
            string onCountDiferenceErrorMessage = "The method did not return the expected collection with elements.";

            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            var subCategoryService = new SubCategoryService(context);

            await this.SeedAndGetSubCategoriesWithCategories(context);

            var methodResult = await subCategoryService.GetDeletableSubCategories();

            var expectedCount = 6;

            AssertExtensions.EqualCountWithMessage(expectedCount, methodResult.Count(), onCountDiferenceErrorMessage);
        }