Пример #1
0
 def testClearApartamentCertainBills(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Gas,100)
     apartamentController.addBill(0,BillType.Gas,100)
     apartamentController.clearApartamentCertainBills(0,BillType.Gas)
     self.assertEqual(len(apartamentController.all[0].bills),1)
Пример #2
0
 def testUndo(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.undo()
     self.assertEqual(apartamentController.getBillsCostOfType(BillType.Water),0)
     apartamentController.addBill(0,BillType.Water,50)
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Water,200)
     apartamentController.addBill(0,BillType.Water,300)
     apartamentController.undo()
     apartamentController.undo()
     self.assertEqual(apartamentController.getBillsCostOfType(BillType.Water),150)
Пример #3
0
 def testGetBillsCost(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Water,150)
     apartamentController.addBill(0,BillType.Water,150)
     self.assertEqual(apartamentController.getBillsCost(apartamentController.all[0].bills),400)
Пример #4
0
 def testAddBill(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     self.assertEqual(apartamentController.all[0].bills[0].cost,100)
Пример #5
0
 def testGetCertainBillsFromAllApartaments(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(1,BillType.Gas,100)
     apartamentController.addBill(2,BillType.Gas,100)
     self.assertEqual(len(apartamentController.getCertainBillsFromAllApartaments(BillType.Gas)),2)
Пример #6
0
 def testGetApartamentsWithCostGreatherThan(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(1,BillType.Water,51)
     apartamentController.addBill(1,BillType.Water,51)
     self.assertEqual(len(apartamentController.getApartamentsWithCostGreatherThan(100)),1)
Пример #7
0
 def testGetApartamentCost(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Water,5)
     self.assertEqual(apartamentController.getApartamentCost(0),105)
Пример #8
0
 def testAllApartamentAndBills(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     self.assertEqual(apartamentController.getAllApartamentsAndBills(),
                      "Apartament #0 , Bill id: 0 , type: Water , cost: 100\n")
Пример #9
0
 def testGetBillsCostOfType(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Gas,10)
     apartamentController.addBill(1,BillType.Water,100)
     apartamentController.addBill(1,BillType.Gas,10)
     apartamentController.addBill(2,BillType.Water,100)
     apartamentController.addBill(2,BillType.Water,5)
     apartamentController.addBill(3,BillType.Gas,80)
     apartamentController.addBill(4,BillType.Water,100)
     apartamentController.addBill(4,BillType.Water,5)
     self.assertEqual(apartamentController.getBillsCostOfType(BillType.Gas),100)
Пример #10
0
 def testDeleteAllBillsFromApartamentsInRanget(self):
     apartamentController = ApartamentController()
     apartamentController.addBill(0,BillType.Water,100)
     apartamentController.addBill(0,BillType.Water,5)
     apartamentController.addBill(1,BillType.Water,100)
     apartamentController.addBill(1,BillType.Water,5)
     apartamentController.addBill(2,BillType.Water,100)
     apartamentController.addBill(2,BillType.Water,5)
     apartamentController.addBill(3,BillType.Water,100)
     apartamentController.addBill(4,BillType.Water,100)
     apartamentController.addBill(4,BillType.Water,5)
     apartamentController.deleteAllBillsFromApartamentsInRange(2,3)
     self.assertEqual(len(apartamentController.all[2].bills),0)
     self.assertEqual(len(apartamentController.all[3].bills),0)
     self.assertEqual(len(apartamentController.all[4].bills),2)