public void GenerateDiscoverTVURLWithGenresSortByPopularityDescPage3() { newManufacturer = new URLManufacturer(); urlBuilder = new DiscoverTVURLBuilder(3); newManufacturer.Construct(urlBuilder); string[] myGenres = { TMDBConstants.WITHGENRES, TMDBConstants.ORSEPARATOR, "" + (int) TMDBConstants.Genres.Drama, "" + (int) TMDBConstants.Genres.Action, "" + (int) TMDBConstants.Genres.SciFi }; urlBuilder.AddDesiredParameters(myGenres); string[] sortByParam = { TMDBConstants.SORTBY, TMDBConstants.POPULARITYDESC }; urlBuilder.AddDesiredParameters(sortByParam); Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" + TMDBConstants.TMDBAPIKEY + "&page=3&with_genres=" + (int) TMDBConstants.Genres.Drama + "|" + (int) TMDBConstants.Genres.Action + "|" + (int) TMDBConstants.Genres.SciFi + "&sort_by=" + TMDBConstants.POPULARITYDESC, urlBuilder.BuiltURL); }
public void GenerateBaseDiscoverTVURLPage1() { newManufacturer = new URLManufacturer(); urlBuilder = new DiscoverTVURLBuilder(1); newManufacturer.Construct(urlBuilder); Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" + TMDBConstants.TMDBAPIKEY + "&page=1", urlBuilder.BuiltURL); }
public void GenerateDiscoverTVURLWithGenres() { newManufacturer = new URLManufacturer(); urlBuilder = new DiscoverTVURLBuilder(1); newManufacturer.Construct(urlBuilder); string[] myGenres = { TMDBConstants.WITHGENRES, TMDBConstants.ORSEPARATOR, "" + (int) TMDBConstants.Genres.Drama, "" + (int) TMDBConstants.Genres.Action, "" + (int) TMDBConstants.Genres.SciFi }; urlBuilder.AddDesiredParameters(myGenres); Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" + TMDBConstants.TMDBAPIKEY + "&page=1&with_genres=" + (int) TMDBConstants.Genres.Drama + "|" + (int) TMDBConstants.Genres.Action + "|" + (int) TMDBConstants.Genres.SciFi, urlBuilder.BuiltURL); }
/*private void OnCreateSwipeToRefresh(SwipeRefreshLayout swipeRefreshLayout) { //TODO Use correct Method call to set colors //TODO Need to determine way to add a bar, swipeRefreshLayout.SetColorScheme( Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloGreenLight); }*/ //TODO Move out into its own class private static string BuildDiscoverUrl(int pageNum, string title) { var myUrl = ""; var mewManufacturer = new URLManufacturer(); IURLBuilder urlBuilder = null; urlBuilder = new DiscoverTVURLBuilder(pageNum); mewManufacturer.Construct(urlBuilder); string[] sortByParam = { TMDBConstants.SORTBY, TMDBConstants.POPULARITYDESC }; urlBuilder.AddDesiredParameters(sortByParam); string[] voteCountGte = { TMDBConstants.VOTECOUNTGTE, 10.ToString() }; urlBuilder.AddDesiredParameters(voteCountGte); if (!title.Equals("Popular")) { string[] genres = { TMDBConstants.WITHGENRES, "" + GetGenreValue(title) }; urlBuilder.AddDesiredParameters(genres); } myUrl = urlBuilder.BuiltURL; return myUrl; }
public async Task populateArrayOfShows() { String myURL = ""; URLManufacturer mewManufacturer = new URLManufacturer(); IURLBuilder urlBuilder = null; urlBuilder = new DiscoverTVURLBuilder(PAGENUM); mewManufacturer.Construct(urlBuilder); string[] sortByParam = { TMDBConstants.SORTBY,TMDBConstants.POPULARITYDESC }; urlBuilder.AddDesiredParameters(sortByParam); string[] voteCountGTE = { TMDBConstants.VOTECOUNTGTE, 10.ToString () }; urlBuilder.AddDesiredParameters(voteCountGTE); if (!_title.Equals("Popular")) { string[] genres = { TMDBConstants.WITHGENRES, "" + getGenreValue (_title) }; urlBuilder.AddDesiredParameters(genres); } myURL = urlBuilder.BuiltURL; Console.WriteLine("##################Is Popular with url = " + myURL); var client = new HttpClient(); var data = await client.GetStringAsync(myURL); JObject o = JObject.Parse(data); await UpdateLocalWithShow(o); //getNextPage(); }