예제 #1
0
        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);
        }
예제 #2
0
        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);
        }