public bool CreateIncome(Income income)
        {
            Income income2 = new Income();

            income2.Amount   = income.Amount;
            income2.Id       = 0;
            income2.Name     = income.Name;
            income2.BudgetId = null;
            return(_oa.InsertIncome(income2));
        }
예제 #2
0
        public void TestOrmAdapter_Insert1()
        {
            //Arrange
            _tdb.Database.EnsureCreated();
            OrmAdapter <Test_BudgetDbContext2> _oa = new OrmAdapter <Test_BudgetDbContext2>(_tdb);

            //Act
            bool insertincomebool = _oa.InsertIncome(new Income()
            {
                Id = 100, Name = "Lockheed", Amount = 10000
            });
            Income income = _tdb.Income.Where(m => m.Id == 100).SingleOrDefault();
            string name   = income.Name;

            // _tdb.Database.EnsureDeleted();

            //Assert
            Assert.True(name == "Lockheed");
        }