public async void TestGetSeasonBySeriesTitleGood() { var omdb = new AsyncOmdbClient(TestData.apikey); var season = await omdb.GetSeasonBySeriesTitleAsync("arrow", 1); var episodes = season.Episodes.ToArray(); Assert.Equal("Pilot", episodes[0].Title); Assert.Equal("2012-10-10", episodes[0].Released); Assert.Equal("1", episodes[0].Episode); Assert.Equal("tt2340185", episodes[0].ImdbId); Assert.Equal("Honor Thy Father", episodes[1].Title); Assert.Equal("2012-10-17", episodes[1].Released); Assert.Equal("2", episodes[1].Episode); Assert.Equal("tt2310910", episodes[1].ImdbId); Assert.Equal("Damaged", episodes[4].Title); Assert.Equal("2012-11-07", episodes[4].Released); Assert.Equal("5", episodes[4].Episode); Assert.Equal("tt2338426", episodes[4].ImdbId); Assert.Equal("Arrow", season.Title); Assert.Equal("1", season.SeasonNumber); Assert.Equal("True", season.Response); }
public async void TestGetItemByTitleGood1() { var omdb = new AsyncOmdbClient(TestData.apikey); var movie = await omdb.GetItemByTitleAsync("Star Wars", true); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Rotten Tomatoes", ratings[1].Source); Assert.Equal("Metacritic", ratings[2].Source); Assert.Equal("Star Wars: Episode IV - A New Hope", movie.Title); Assert.Equal("1977", movie.Year); Assert.Equal("PG", movie.Rated); Assert.Equal("25 May 1977", movie.Released); Assert.Equal("121 min", movie.Runtime); Assert.Equal("George Lucas", movie.Director); Assert.Equal("George Lucas", movie.Writer); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("tt0076759", movie.ImdbId); Assert.Equal("movie", movie.Type); Assert.Equal("21 Sep 2004", movie.Dvd); Assert.Equal("20th Century Fox", movie.Production); Assert.Equal("http://www.starwars.com/episode-iv/", movie.Website); Assert.Null(movie.TotalSeasons); Assert.Equal("True", movie.Response); }
public async void TestGetItemByTitleGood2() { var omdb = new AsyncOmdbClient(TestData.apikey, true); var movie = await omdb.GetItemByTitleAsync("Star Wars", OmdbType.Movie, 2017, false); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Rotten Tomatoes", ratings[1].Source); Assert.Equal("Metacritic", ratings[2].Source); Assert.Equal("Star Wars: The Last Jedi", movie.Title); Assert.Equal("2017", movie.Year); Assert.Equal("PG-13", movie.Rated); Assert.Equal("15 Dec 2017", movie.Released); Assert.Equal("152 min", movie.Runtime); Assert.Equal("Rian Johnson", movie.Director); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("movie", movie.Type); Assert.Equal("http://www.rottentomatoes.com/m/star_wars_episode_viii/", movie.TomatoUrl); Assert.Equal("Walt Disney Pictures", movie.Production); Assert.Null(movie.TotalSeasons); Assert.Equal("True", movie.Response); }
public OmdbClient(string apikey, bool rottenTomatoesRatings = false) { ApiKey = apikey.ThrowIfNullOrWhiteSpace(nameof(apikey)); UseRottenTomatoesRatings = rottenTomatoesRatings; _omdbClient = new AsyncOmdbClient(apikey, rottenTomatoesRatings); }
public async void TestGetEpisodeBySeriesTitleGood() { var omdb = new AsyncOmdbClient(TestData.apikey); var episode = await omdb.GetEpisodeBySeriesTitleAsync("arrow", 1, 1); var ratings = episode.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Pilot", episode.Title); Assert.Equal("2012", episode.Year); Assert.Equal("TV-PG", episode.Rated); Assert.Equal("10 Oct 2012", episode.Released); Assert.Equal("1", episode.SeasonNumber); Assert.Equal("1", episode.EpisodeNumber); Assert.Equal("45 min", episode.Runtime); Assert.Equal("David Nutter", episode.Director); Assert.Equal("English", episode.Language); Assert.Equal("USA, Canada", episode.Country); Assert.Equal("tt2340185", episode.ImdbId); Assert.Equal("tt2193021", episode.SeriesId); Assert.Equal("episode", episode.Type); Assert.Equal("True", episode.Response); }
public async void TestGetItemByTitleBad() { var omdb = new AsyncOmdbClient(TestData.apikey, true); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByTitleAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByTitleAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByTitleAsync(" ")); await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => omdb.GetItemByTitleAsync("star wars", 1500)); }
public async void TestGetItemByIdBad() { var omdb = new AsyncOmdbClient(TestData.apikey); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByIdAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByIdAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetItemByIdAsync(" ")); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetItemByIdAsync("wrongID")); }
public async void TestGetItemByIdGood2() { var omdb = new AsyncOmdbClient(TestData.apikey, true); var game = await omdb.GetItemByIdAsync("tt1814884"); Assert.Equal("The Elder Scrolls V: Skyrim", game.Title); Assert.Equal("2011", game.Year); Assert.Equal("N/A", game.Rated); Assert.Equal("11 Nov 2011", game.Released); Assert.Equal("N/A", game.Runtime); }
public async void TestGetEpisodeByEpisodeIdBad() { var omdb = new AsyncOmdbClient(TestData.apikey); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetEpisodeByEpisodeIdAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetEpisodeByEpisodeIdAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetEpisodeByEpisodeIdAsync(" ")); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetEpisodeByEpisodeIdAsync("asdf")); }
public async void TestGetSeasonBySeriesTitleBad() { var omdb = new AsyncOmdbClient(TestData.apikey); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSeasonBySeriesTitleAsync(null, 1)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSeasonBySeriesTitleAsync("", 1)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSeasonBySeriesTitleAsync(" ", 1)); await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => omdb.GetSeasonBySeriesTitleAsync("tt2193021", 0)); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetSeasonBySeriesTitleAsync("asdf", 1)); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetSeasonBySeriesTitleAsync("arrow", 100)); }
public async System.Threading.Tasks.Task TestGetSearchListBad() { var omdb = new AsyncOmdbClient(TestData.apikey); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSearchListAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSearchListAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => omdb.GetSearchListAsync(" ")); await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => omdb.GetSearchListAsync("star wars", 0)); await Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => omdb.GetSearchListAsync(1500, "star wars", 0)); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetSearchListAsync("asdf")); }
public async void TestGetSearchListGood2() { var omdb = new AsyncOmdbClient(TestData.apikey); var searchList = await omdb.GetSearchListAsync("Skyrim", OmdbType.Game); var search = searchList.SearchResults.ToArray(); Assert.Equal("The Elder Scrolls V: Skyrim", search[0].Title); Assert.Equal("2011", search[0].Year); Assert.Equal("tt1814884", search[0].ImdbId); Assert.Equal("game", search[0].Type); Assert.Equal("The Elder Scrolls V: Skyrim - Dawnguard", search[1].Title); Assert.Equal("2012", search[1].Year); Assert.Equal("tt5333506", search[1].ImdbId); Assert.Equal("game", search[1].Type); Assert.Null(searchList.Error); Assert.Equal("True", searchList.Response); }
public async void TestGetSearchListGood() { var omdb = new AsyncOmdbClient(TestData.apikey); var searchList = await omdb.GetSearchListAsync("Arrow", 1); var search = searchList.SearchResults.ToArray(); Assert.Equal("Arrow", search[0].Title); Assert.Equal("2012–", search[0].Year); Assert.Equal("tt2193021", search[0].ImdbId); Assert.Equal("series", search[0].Type); Assert.Equal("Broken Arrow", search[1].Title); Assert.Equal("1996", search[1].Year); Assert.Equal("tt0115759", search[1].ImdbId); Assert.Equal("movie", search[1].Type); Assert.Null(searchList.Error); Assert.Equal("True", searchList.Response); }
public async void TestGetItemByTitleGood3() { var omdb = new AsyncOmdbClient(TestData.apikey, true); var movie = await omdb.GetItemByTitleAsync("Arrow", OmdbType.Series, 2012, false); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Arrow", movie.Title); Assert.Equal("2012–", movie.Year); Assert.Equal("TV-14", movie.Rated); Assert.Equal("10 Oct 2012", movie.Released); Assert.Equal("42 min", movie.Runtime); Assert.Equal("N/A", movie.Director); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("series", movie.Type); Assert.Equal("N/A", movie.Dvd); Assert.Equal("N/A", movie.BoxOffice); Assert.Equal("N/A", movie.Production); Assert.Equal("N/A", movie.Website); Assert.Equal("True", movie.Response); }
/// <summary> /// Initializes instance according to parameter values. /// </summary> /// <param name="apiKey">Key to get access to OMDb service.</param> /// <exception cref="ArgumentException"> /// <paramref name="apiKey" /> is <c>null</c>, presents empty strings or contains only /// whitespaces. /// </exception> public OmdbCrawlerAsync(string apiKey) { _apiKey = apiKey.ThrowIfNullOrWhiteSpace(nameof(apiKey)); _omdbClient = new AsyncOmdbClient(_apiKey); }
public async void TestGetItemByTitleBad2() { var omdb = new AsyncOmdbClient(TestData.apikey, true); await Assert.ThrowsAsync <HttpRequestException>(() => omdb.GetItemByTitleAsync("Skyrim", OmdbType.Game)); }
public AssetService() { omdb = new AsyncOmdbClient(omdbApiKey); }
public SearchModule(AsyncOmdbClient omdb, YouTubeService youTube, WeatherService weather) { _omdb = omdb; _youTube = youTube; _weather = weather; }