public void Delete_Country_By_Id() { var countryToSave = new Country(); countryToSave.Name = "sarasa"; countryToSave.Id = 1; var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "Delete_Country_By_Id") .Options; using (var context = new ApplicationDbContext(options)) { var service = new CountriesService(context); service.AddCountry(countryToSave); Assert.Single(service.GetAllCountries()); service.DeleteById(1); Assert.Empty(service.GetAllCountries()); } }