public void RemoveMethodShouldRemoveBank() { var dbContext = YourMoney.Tests.Base.BaseServiceTests.GetDatabase(); var item = new Bank() { Id = 1, Name = "ProCredit" }; var items = new BanksService(dbContext); items.Add(item.Name); items.Remove(item.Id); var result = dbContext.Banks.FirstOrDefault(); Assert.Null(result); }
public void RemoveMethodShouldRemoveBank() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "AddBank_Banks_DB") .Options; var dbContext = new ApplicationDbContext(options); var item = new Bank() { Id = 1, Name = "ProCredit" }; var items = new BanksService(dbContext); items.Add(item.Name); items.Remove(item.Id); var result = dbContext.Banks.FirstOrDefault(b => b.Id == item.Id); Assert.Null(result); }