public bool UpdateIncome(Income income) { Income income2 = GetIncome(income.Id); income2.Amount = income.Amount; income2.Name = income.Name; return(_oa.UpdateIncome(income2)); }
public void TestOrmAdapter_Update1() { _tdb.Database.EnsureCreated(); OrmAdapter <Test_BudgetDbContext2> _oa = new OrmAdapter <Test_BudgetDbContext2>(_tdb); Income income = _tdb.Income.Where(m => m.Id == 1).SingleOrDefault(); income.Name = "Great job"; _oa.UpdateIncome(income); Income inc = _tdb.Income.Where(m => m.Id == 1).SingleOrDefault(); string newName = inc.Name; // _tdb.Database.EnsureDeleted(); Assert.True(newName == "Great job"); }