示例#1
0
        public async Task CreateBrandShouldCreateNewBrand()
        {
            var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: "TestDB").Options;

            using var context = new WHMSDbContext(options);
            var service = new BrandsService(context);

            var brandId = await service.CreateBrandAsync("TestBrand");

            var brandsCount   = service.GetAllBrandsCount();
            var expectedCount = 1;

            Assert.Equal(expectedCount, brandsCount);
            Assert.Equal(1, brandId);
        }