Пример #1
0
 public Budget Add(Budget budget)
 {
     return AddOrUpdate<Budget>("mm_Budgets_Create", new {
         UserID = _userId,
         Account_AccountID = budget.Account_AccountID,
         Start = budget.Start,
         End = budget.End
     });
 }
        public void Data_Create_Budget()
        {
            var repository = new BudgetRepository(_dataConnectionString, 1);

            var budget = new MABMoney.Domain.Budget {
                Account_AccountID = 2,
                Start = new DateTime(2015, 3, 1),
                End = new DateTime(2015, 3, 31)
            };

            var result = repository.Add(budget);

            Assert.IsTrue(result.BudgetID == 5);
            Assert.IsTrue(result.Account_AccountID == 2);
            Assert.IsTrue(result.Start == new DateTime(2015, 3, 1));
            Assert.IsTrue(result.End == new DateTime(2015, 3, 31));
            Assert.IsTrue(result.CreatedBy == 1);
            Assert.IsTrue(result.CreatedDate.Date == DateTime.Now.Date);
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
        }