Пример #1
0
        public void testInsertDeleteComment()
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            Comment     comment     = new Comment()
            {
                Content  = "test de content pour le commentaire",
                Date     = DateTime.Now,
                Film     = filmManager.getFilmFromId(11) /*star wars*/,
                Rate     = 19,
                Username = "******"
            };

            Console.WriteLine("insert comment...");
            filmManager.InsertComment(comment);
            Console.WriteLine("insert comment ok : affichage à partir de la lecture de la bd :");

            Film film      = filmManager.getFilmFromId(comment.Film.Id);
            int  idComment = 0;

            foreach (Comment filmComment in film.Comments)
            {
                idComment = filmComment.Id;
            }

            Console.WriteLine("Film : \n" + film.ToStringAll());

            Comment commentFromBd = filmManager.getCommentFromId(idComment);

            Console.WriteLine("Comment : \n" + commentFromBd.ToStringWithFilm());

            Console.WriteLine();
            Console.WriteLine("Delete comment...");
            filmManager.DeleteComment(commentFromBd);
            Console.WriteLine("Apres Delete comment...");

            film = filmManager.getFilmFromId(comment.Film.Id);
            Console.WriteLine("Film : \n" + film.ToStringAll());

            commentFromBd = filmManager.getCommentFromId(commentFromBd.Id);
            if (commentFromBd == null)
            {
                Console.WriteLine("commentaire bien supprimé");
            }
            else
            {
                Console.WriteLine("commentaire pas supprimé : " + commentFromBd);
            }

            Assert.Pass();
        }
Пример #2
0
        [TestCase(15)] //personne !
        public void testGetActorFromId(int id)
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            Actor       actor       = filmManager.getActorFromId(id);

            if (actor != null)
            {
                Console.WriteLine("Actor pour l'id(" + id + ") : " + actor.ToStringWithFilms());
            }
            else
            {
                Console.WriteLine("Pas d'actor trouvé pour l'id : " + id);
            }
        }
Пример #3
0
        public void TestGetFavoriteActors(int from, int to)
        {
            FilmManager  filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            List <Actor> actors      = filmManager.GetFavoriteActors(from, to).ToList();

            Console.WriteLine("Acteur qui joue dans 2 films ou plus : de " + from + ", to " + to);
            int i = 1;

            foreach (Actor actor in actors)
            {
                Console.WriteLine("[" + i + "]" + actor.ToStringWithFilms());
                i++;
            }
        }
Пример #4
0
        public void testGetCommentsFromTo(int from, int to)
        {
            FilmManager    filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            List <Comment> comments    = filmManager.getCommentsFromTo(from, to).ToList();

            Console.WriteLine("Comments de " + from + " a " + to + " :");
            int i = 1;

            foreach (Comment comment in comments)
            {
                Console.WriteLine("Comments [" + i + "]" + " : " + comment.ToStringWithFilm());
                i++;
            }
            Console.WriteLine("Comments de : " + "Comments de " + from + " a " + to);
        }
Пример #5
0
        public void testGetGenresFromTo(int from, int to)
        {
            FilmManager  filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            List <Genre> genres      = filmManager.getGenresFromTo(from, to).ToList();

            Console.WriteLine("Genres de " + from + " a " + to + " :");
            int i = 1;

            foreach (Genre genre in genres)
            {
                Console.WriteLine("Genres [" + i + "]" + " : " + genre.ToStringWithFilms());
                i++;
            }
            Console.WriteLine("Genres de : " + "Genres de " + from + " a " + to);
        }
Пример #6
0
        public void testGetActorsFromTo(int from, int to)
        {
            FilmManager  filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            List <Actor> actors      = filmManager.getActorsFromTo(from, to).ToList();

            Console.WriteLine("Acteurs de " + from + " a " + to + " :");
            int i = 1;

            foreach (Actor actor in actors)
            {
                Console.WriteLine("Acteurs [" + i + "]" + " : " + actor.ToStringWithFilms());
                i++;
            }
            Console.WriteLine("Acteurs de : " + "Acteurs de " + from + " a " + to);
        }
Пример #7
0
        public void testGetFilmsFromTo(int from, int to)
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            List <Film> films       = filmManager.getFilmsFromTo(from, to).ToList();

            Console.WriteLine("Films de " + from + " a " + to + " :");
            int i = 1;

            foreach (Film film in films)
            {
                Console.WriteLine("Film [" + i + "]" + " : " + film.ToStringAll());
                i++;
            }
            Console.WriteLine("fin de : " + "Films de " + from + " a " + to);
        }
Пример #8
0
        public void testFindFilmsByPartialTitle(int from, int to, string titre)
        {
            FilmManager       filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            IQueryable <Film> testNull    = filmManager.FindFilmsByPartialTitle(from, to, titre);

            Console.WriteLine("Liste des films dont le titre contient : " + titre);
            if (testNull != null)
            {
                List <Film> films = testNull.ToList();
                int         i     = 1;
                Console.WriteLine("DEBUG nbr films = " + films.Count);
                foreach (Film film in films)
                {
                    Console.WriteLine("[" + i + "]\n" + film.ToStringAll());
                    i++;
                }
            }
        }
Пример #9
0
        [TestCase(0, 10, "a b c d")]               //plus de 2 mots
        public void testFindListFilmByPartialActorName(int from, int to, string nomActeur)
        {
            FilmManager       filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            IQueryable <Film> testNull    = filmManager.FindListFilmByPartialActorName(from, to, nomActeur);

            Console.WriteLine("Liste des films dans lequel un acteur dont on donne un nom partiellement ou entierement : " + nomActeur);
            if (testNull != null)
            {
                List <Film> films = testNull.ToList();
                int         i     = 1;
                Console.WriteLine("DEBUG nbr films = " + films.Count);
                foreach (Film film in films)
                {
                    Console.WriteLine("[" + i + "]\n" + film.ToStringAll());
                    i++;
                }
            }
        }
Пример #10
0
        [TestCase(10)] //rien !
        public void testGetFilmFromId(int id)
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());
            Film        film        = filmManager.getFilmFromId(id);

            if (film != null)
            {
                Console.WriteLine("Film pour l'id(" + id + ") : " + film.ToStringAll());
                Console.WriteLine("comments du film en détails : ");
                foreach (Comment filmComment in film.Comments)
                {
                    Console.WriteLine(filmComment.ToStringWithFilm());
                }
            }
            else
            {
                Console.WriteLine("Pas de Film trouvé pour l'id : " + id);
            }
        }
Пример #11
0
        public void testFindNumberFilmsByPartialTitle(string titre)
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());

            Console.WriteLine("Nombre de films dont le titre contient(" + titre + ") =  " + filmManager.FindFilmsByPartialTitle(titre));
        }
Пример #12
0
        public void testGetNumberFavoriteActor()
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());

            Console.WriteLine("nombre d'acteur qui jouent dans au moins 2 films : " + filmManager.GetFavoriteActors());
        }
Пример #13
0
        [TestCase("a b c d")]               //plus de 2 mots
        public void testNumberFindListFilmByPartialActorName(string nomActeur)
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());

            Console.WriteLine("nombre de films pour l'acteur dont le nom contient(" + nomActeur + ") = " + filmManager.FindListFilmByPartialActorName(nomActeur));
        }
Пример #14
0
        public void testGetNumberCommentsFromTo()
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());

            Console.WriteLine("nombre de comments dans la bd = " + filmManager.getCommentsFromTo());
        }
Пример #15
0
        public void testGetNumberActorsFromTo()
        {
            FilmManager filmManager = new FilmManager(GetDbContextOptions.getFilmDbContextOptions());

            Console.WriteLine("nombre d'acteurs dans la bd = " + filmManager.getActorsFromTo());
        }