示例#1
0
    def __test_writeFileInchirieri(self):
        self.__repoClient = FileRepoClient("test_clienti.txt",
                                           client.read_client,
                                           client.write_client)
        self.__serviceFileClienti = ServiceClienti(self.__repoClient,
                                                   self.__validareClienti)
        self.__serviceFileClienti.add_client(1, "Ionica", "192350156283")

        self.__repoFilm = FileRepoFilm("test_filme.txt", film.read_film,
                                       film.write_film)
        self.__serviceFileFilme = ServiceFilme(self.__repoFilm,
                                               self.__validareFilme)
        self.__serviceFileFilme.add_film(10, "morometii", "este foarte frumos",
                                         "action")

        self.__repoInchiriere = FileRepoInchiriere("test_inchirieri.txt",
                                                   inchiriere.read_inchiriere,
                                                   inchiriere.write_inchiriere)
        self.__serviceFileInchirieri = ServiceInchiriere(
            self.__repoInchiriere, self.__validareInchirieri, self.__repoFilm,
            self.__repoClient)
        self.__serviceFileInchirieri.add_inchiriere(1, 10, 0)

        self.assertEqual(self.__repoInchiriere.size(), 2)
        self.__serviceFileClienti.sterge_clienti(1)
        self.__serviceFileFilme.sterge_filme(10)
        self.__serviceFileInchirieri.sterge_dupa_clienti(1)
示例#2
0
 def __test_writeFileFilme(self):
     self.__repoFilm = FileRepoFilm("test_filme.txt", film.read_film,
                                    film.write_film)
     self.__serviceFileFilme = ServiceFilme(self.__repoFilm,
                                            self.__validareFilme)
     self.__serviceFileFilme.add_film(10, "morometii", "este foarte frumos",
                                      "action")
     self.assertEqual(self.__repoFilm.size(), 2)
     film_gasit = self.__repoFilm.cauta(10)
     self.assertEqual(film_gasit.getTitlu(), "morometii")
     self.assertEqual(film_gasit.getDescriere(), "este foarte frumos")
     self.assertEqual(film_gasit.getGen(), "action")
     self.__serviceFileFilme.sterge_filme(10)
示例#3
0
def start():

    teste = Teste()
    teste.all_tests()
    validFilm = ValidareFilm()
    validClient = ValidareClient()
    validInchiriere = ValidareInchiriere()

    #repoFilme = RepoFilm()
    repoFilme = FileRepoFilm("filme.txt", film.read_film, film.write_film)
    #repoClienti = RepoClient()
    repoClienti = FileRepoClient("clienti.txt", client.read_client,
                                 client.write_client)
    #repoInchiriere = RepoInchiriere()
    repoInchiriere = FileRepoInchiriere("inchirieri.txt",
                                        inchiriere.read_inchiriere,
                                        inchiriere.write_inchiriere)

    serviceFilme = ServiceFilme(repoFilme, validFilm)
    serviceClienti = ServiceClienti(repoClienti, validClient)
    serviceInchirieri = ServiceInchiriere(repoInchiriere, validInchiriere,
                                          repoFilme, repoClienti)
    ui = Consola(serviceFilme, serviceClienti, serviceInchirieri)
    ui.porneste()