public async void TestCategoryListWithItemsOnePageSizeTen()
        {
            var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            HomeMyDayDbContext context = new HomeMyDayDbContext(optionsBuilder.Options);

            context.FaqCategory.AddRange(
                new FaqCategory()
            {
                CategoryName = "TestA"
            },
                new FaqCategory()
            {
                CategoryName = "TestB"
            }
                );

            await context.SaveChangesAsync();

            IFaqRepository repository = new EFFaqRepository(context);

            PaginatedList <FaqCategory> paginatedCategories = await repository.ListCategories(1, 10);

            Assert.NotNull(paginatedCategories);
            Assert.Equal(2, paginatedCategories.Count);
            Assert.Equal(1, paginatedCategories.PageIndex);
            Assert.Equal(10, paginatedCategories.PageSize);
            Assert.Equal(1, paginatedCategories.TotalPages);
            Assert.False(paginatedCategories.HasPreviousPage);
            Assert.False(paginatedCategories.HasNextPage);
        }
        public void TestFaqFilledList()
        {
            var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            HomeMyDayDbContext context = new HomeMyDayDbContext(optionsBuilder.Options);

            context.FaqCategory.AddRange(
                new FaqCategory()
            {
                CategoryName = "TestA"
            },
                new FaqCategory()
            {
                CategoryName = "TestB"
            }
                );
            context.SaveChanges();

            IFaqRepository repository    = new EFFaqRepository(context);
            var            faqCategories = repository.ListCategories();

            Assert.NotNull(faqCategories);
            Assert.True(faqCategories.Result.Count() == 2);
        }
        public void TestFaqEmptyList()
        {
            var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            HomeMyDayDbContext context    = new HomeMyDayDbContext(optionsBuilder.Options);
            IFaqRepository     repository = new EFFaqRepository(context);

            var faqCategories = repository.ListCategories();

            Assert.True(!faqCategories.Result.Any());
        }
        public async void TestEmptyListPageBelowZeroPageSizeBelowZero()
        {
            var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>();

            optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            HomeMyDayDbContext context = new HomeMyDayDbContext(optionsBuilder.Options);

            IFaqRepository repository = new EFFaqRepository(context);

            PaginatedList <FaqCategory> paginatedCategories = await repository.ListCategories(-5, -10);

            Assert.NotNull(paginatedCategories);
            Assert.Empty(paginatedCategories);
            Assert.Equal(1, paginatedCategories.PageIndex);
            Assert.Equal(10, paginatedCategories.PageSize);
            Assert.Equal(1, paginatedCategories.TotalPages);
            Assert.False(paginatedCategories.HasPreviousPage);
            Assert.False(paginatedCategories.HasNextPage);
        }