public void getAllTest()
 {
     List<Budget> expected = new List<Budget>();
     Budget b = new Budget();
     b.Id = 2;
     b.AllocatedBudget = 500;
     b.BudgetItems.Add(BudgetItemModel.getByBudgetId(2)[0]);
     expected.Add(b);
     Budget a = new Budget();
     a.Id = 37;
     a.AllocatedBudget = 0;
     a.BudgetItems.Add(BudgetItemModel.getByBudgetId(37)[0]);
     a.BudgetItems.Add(BudgetItemModel.getByBudgetId(37)[1]);
     expected.Add(a);
     Budget c = new Budget();
     c.Id = 43;
     c.AllocatedBudget = 0;
     expected.Add(c);
     List<Budget> actual = BudgetModel.getAll();
     Assert.AreEqual(expected.Count, actual.Count);
     Console.Out.Write("Length is " + actual.Count);
     for (int i = 0; i < actual.Count; i++)
     {
         Console.Out.WriteLine("Actual is " + actual[i].Id);
         Console.Out.WriteLine("Expected is " + expected[i].Id);
         Assert.IsTrue(this.PropertiesEqual(actual[i], expected[i]));
     }
 }
예제 #2
0
 public BudgetModel(DBLayer.Budget b)
 {
     this._dbObj = b;
 }
예제 #3
0
 public BudgetModel()
 {
     this._dbObj    = new DBLayer.Budget();
     this._dbObj.Id = -1;
     this._dbObj.AllocatedBudget = 500;
 }
 public void getByIDTest()
 {
     int id = 2;
     Budget expected = new Budget();
     expected.Id = 2;
     expected.AllocatedBudget = 500;
     expected.BudgetItems.Add(BudgetItemModel.getByBudgetId(2)[0]);
     Budget actual = BudgetModel.getByID(id);
     Assert.IsTrue(this.PropertiesEqual(actual, expected));
 }
        public void updateObjTest()
        {
            Budget expected = new Budget();
            expected.Id = 43;
            expected.AllocatedBudget = 30;
            BudgetModel.updateObj(expected);
            Budget actual = BudgetModel.getByID(43);
            Assert.IsTrue(this.PropertiesEqual(actual, expected));

            //revert database back to original state so our getAll() test will pass
            expected.AllocatedBudget = 0;
            BudgetModel.updateObj(expected);
        }
예제 #6
0
 public BudgetModel(DBLayer.Budget b)
 {
     this._dbObj = b;
 }
예제 #7
0
 public BudgetModel()
 {
     this._dbObj = new DBLayer.Budget();
     this._dbObj.Id = -1;
     this._dbObj.AllocatedBudget = 500;
 }