public void DeleteImagesShouldRemoveTheImagesOfMod() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "RemoveImagesOnEditShouldRemoveTheImagesOfModOnEdit_DB") .Options; var dbContext = new ApplicationDbContext(options); var modService = new ModService(dbContext); var urls = new List <string>(); urls.Add("qqq"); urls.Add("222"); urls.Add("rrr"); var mod = new Mod(); dbContext.Mods.Add(mod); dbContext.SaveChanges(); modService.AddGalleryUrls(mod.Id, urls); modService.DeleteImages(mod.Id); Assert.Empty(mod.Pictures); }