public List <Schedule> GetSchedulesByMovieId(int?movieId) { if (movieId == null) { return(null); } return(sdal.GetSchedulesByMovieId(movieId)); }
public void GetSchedulesByMovieIdTest1() { int movieId = 3; List <Schedule> sches = scheDAL.GetSchedulesByMovieId(movieId); query = $"select * from Schedules where movie_id = " + movieId + " order by rand() limit 1;"; Schedule scheRand = GetScheduleExecQuery(query); query = $"select * from Schedules where movie_id = " + movieId + " order by sche_id asc limit 1;"; Schedule scheTop = GetScheduleExecQuery(query); query = $"select * from Schedules where movie_id = " + movieId + " order by sche_id desc limit 1;"; Schedule scheBottom = GetScheduleExecQuery(query); Assert.NotNull(sches); Assert.NotNull(scheRand); Assert.NotNull(scheTop); Assert.NotNull(scheBottom); Assert.Contains(scheRand, sches); Assert.True(sches.IndexOf(scheTop) == 0); Assert.True(sches.IndexOf(scheBottom) == (sches.Count - 1)); }