public BudgetItemModel() { this._dbObj = new DBLayer.BudgetItem(); this.Id = -1; this.Name = ""; this.Cost = 0; }
public BudgetItemModel() { this._dbObj = new DBLayer.BudgetItem(); this.Id = -1; this.Name = ""; this.Cost = 0; }
public void createUpdateDeleteObjTest() { //test for createObj BudgetItem expected = new BudgetItem(); expected.BudgetId = 2; expected.Cost = 10; expected.Name = "test"; BudgetItemModel.createObj(expected); int count = BudgetItemModel.getByBudgetId(2).Count; BudgetItem actual = BudgetItemModel.getByBudgetId(2)[count - 1]; Assert.IsTrue(PropertiesEqual(expected, actual)); //test for updateObj expected.Name = "new name"; BudgetItemModel.updateObj(expected); actual = BudgetItemModel.getByBudgetId(2)[count - 1]; Assert.IsTrue(PropertiesEqual(expected, actual)); //test for deleteById BudgetItemModel.deleteById(actual.Id); Assert.AreEqual(1, BudgetItemModel.getByBudgetId(2).Count); }
public BudgetItemModel(DBLayer.BudgetItem b) { this._dbObj = b; }
public BudgetItemModel(DBLayer.BudgetItem b) { this._dbObj = b; }
public void getAllTest() { List<BudgetItem> expected = new List<BudgetItem>(); BudgetItem a = new BudgetItem(); a.BudgetId = 2; a.Cost = 432; a.Id = 6; a.Name = "New Item"; expected.Add(a); BudgetItem c = new BudgetItem(); c.BudgetId = 37; c.Cost = 50; c.Id = 22; c.Name = "watermelon"; expected.Add(c); BudgetItem b = new BudgetItem(); b.BudgetId = 37; b.Cost = 60; b.Id = 23; b.Name = "papaya"; expected.Add(b); List<BudgetItem> actual = BudgetItemModel.getAll(); Assert.AreEqual(expected.Count, actual.Count); Console.Out.WriteLine("Length is " + actual.Count); for (int i = 0; i < actual.Count; i++) { Console.Out.WriteLine("Actual is " + actual[i].Name); Console.Out.WriteLine("Expected is " + expected[i].Name); Assert.IsTrue(this.PropertiesEqual(actual[i], expected[i])); } }
public void getByIDTest() { int id = 6; BudgetItem expected = new BudgetItem(); expected.Id = 6; expected.BudgetId = 2; expected.Cost = 432; expected.Name = "New Item"; BudgetItem actual; actual = BudgetItemModel.getByID(id); Assert.IsTrue(this.PropertiesEqual(actual, expected)); }