public IActionResult GetListActorsByIdFilm(int from, int to, int idFilm) { ResponsePagine <List <LightActorDTO> > responsePagine = new ResponsePagine <List <LightActorDTO> >() { Status = StatusCodes.Status500InternalServerError, Errors = null, Message = null, Succeded = false, Value = null, FirstPage = null, From = from, To = to, LastPage = null, TotalRecord = -1, }; try { List <LightActorDTO> actors = _bllManager.GetListActorsByIdFilm(from, to, idFilm); if (actors == null) { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "getActorsFromTo(from=" + from + ", to=" + to + ") RETURN null"; } else { int nbrActor = _bllManager.getActorsFromTo(); if (nbrActor != -1) { if (actors.Count > 0) { responsePagine.Status = StatusCodes.Status200OK; responsePagine.Succeded = true; responsePagine.Value = actors; responsePagine.FirstPage = ApiRoute.Actors.ActorBase + "/filmid=" + idFilm + "/from=0/to=" + ((to - @from).ToString()); responsePagine.LastPage = ApiRoute.Actors.ActorBase + "/filmid=" + idFilm + "/from=" + (nbrActor - (to - @from)).ToString() + "/to=" + nbrActor; responsePagine.TotalRecord = nbrActor; } else { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "nombre d'actor trouvé = 0"; } } else { responsePagine.Status = StatusCodes.Status404NotFound; responsePagine.Errors = "nombre d'actor trouvé = -1"; } } } catch (Exception e) { responsePagine.Errors = "getActorsFromTo(from=" + from + ", to=" + to + ") EXCEPTION : " + e.ToString(); } return(StatusCode(responsePagine.Status, responsePagine)); }
public void testGetNumberActorsByIdFilm(int idFilm) { BllManager bllManager = new BllManager(); Console.WriteLine("nombre d'acteur pour le fiml (" + idFilm + ") = " + bllManager.GetListActorsByIdFilm(idFilm)); Assert.Pass(); }
[TestCase(0, 25, 10)] //aucun film pour l'id 10 public void testGetListActorsByIdFilm(int from, int to, int idFilm) { BllManager bllManager = new BllManager(); List <LightActorDTO> lightActorDtos = bllManager.GetListActorsByIdFilm(from, to, idFilm).ToList(); Console.WriteLine("liste des acteurs pour le film : " + idFilm); int i = 0; foreach (LightActorDTO lightActorDto in lightActorDtos) { Console.WriteLine("[" + i + "]" + lightActorDto); i++; } Assert.Pass(); }