public async Task DeleteBrandShouldDeleteExistingBrand() { var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; using var context = new WHMSDbContext(options); await context.Brands.AddAsync(new Brand { Id = 10 }); var service = new BrandsService(context); var success = await service.DeleteBrandAsync(10); Assert.True(success); }
public async Task DeleteBrandShouldReturnFalseBrandDoesNotExist() { var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; using var context = new WHMSDbContext(options); await context.Brands.AddAsync(new Brand { Name = "Test" }); await context.SaveChangesAsync(); var service = new BrandsService(context); var success = await service.DeleteBrandAsync(20); Assert.False(success); }