예제 #1
0
        public async Task GetAllBrandsShouldReturnMaxPageSize()
        {
            var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;

            using var context = new WHMSDbContext(options);
            for (int i = 0; i < 100; i++)
            {
                await context.Brands.AddAsync(new Brand { Name = i.ToString() });
            }

            await context.SaveChangesAsync();

            var service = new BrandsService(context);

            var brands         = service.GetAllBrands <BrandViewModel>(1);
            var brandsCount    = brands.ToList().Count();
            var exepcetedCount = GlobalConstants.PageSize;

            Assert.Equal(exepcetedCount, brandsCount);
        }