Esempio n. 1
0
  def test_addPerson(self):
    repo = PersonRepository()
    cont = PersonsController(repo, PersonsActivitiesRepo(), UndoRedoController())

    cont.addPerson(Person(1, "Razvan", 123, "Cluj"))

    self.assertIn(Person(1, "Razvan", 123, "Cluj"), repo.getAll())
Esempio n. 2
0
  def test_getPersonsList(self):
    repo = PersonRepository()
    cont = PersonsController(repo, PersonsActivitiesRepo(), UndoRedoController())

    cont.addPerson(Person(1, "Razvan", 123, "Cluj"))
    cont.addPerson(Person(2, "Razvan", 321, "Zalau"))
    cont.addPerson(Person(3, "Alex", 12231233, "Iasi"))

    self.assertEqual(cont.getPersonsList(), repo.getAll())
Esempio n. 3
0
 def test_findById(self):
   repo = PersonRepository()
   repo.add(Person(1, "Razvan", 123, "Cluj"))
   self.assertEqual(Person(1, "Razvan", 123, "Cluj"), repo.findById(1))
   self.assertIsNone(repo.findById(3))
Esempio n. 4
0
 def test_add(self):
   repo = PersonRepository()
   repo.add(Person(1, "Razvan", 123, "Cluj"))
   self.assertIn(Person(1, "Razvan", 123, "Cluj"), repo.getAll())
Esempio n. 5
0
  def test_getAll(self):
    repo = PersonRepository()
    repo.add(Person(1, "Razvan", 123, "Cluj"))
    repo.add(Person(2, "Razvan", 321, "Zalau"))
    repo.add(Person(3, "Alex", 12231233, "Iasi"))
    repo.add(Person(4, "Mihai", 124443213, "Bucurest"))
    repo.add(Person(5, "Dan", 123321312, "Oradea"))

    self.assertEqual(repo.getAll(), [Person(1, "Razvan", 123, "Cluj"), Person(2, "Razvan", 321, "Zalau"),
                                     Person(3, "Alex", 12231233, "Iasi"), Person(4, "Mihai", 124443213, "Bucurest"),
                                     Person(5, "Dan", 123321312, "Oradea")])
Esempio n. 6
0
 def test_remove(self):
   repo = PersonRepository()
   repo.add(Person(1, "Razvan", 123, "Cluj"))
   repo.add(Person(2, "Razvan", 321, "Zalau"))
   self.assertEqual(repo.remove(2), Person(2, "Razvan", 321, "Zalau"))
Esempio n. 7
0
 def test_findByName(self):
   repo = PersonRepository()
   repo.add(Person(1, "Razvan", 123, "Cluj"))
   repo.add(Person(2, "Razvan", 321, "Zalau"))
   repo.add(Person(3, "Alex", 12231233, "Iasi"))
   self.assertEqual([Person(1, "Razvan", 123, "Cluj"), Person(2, "Razvan", 321, "Zalau")], repo.findByName("Razvan"))