Esempio n. 1
0
        public void TestGetItemByIdBad()
        {
            var omdb = new OmdbClient(TestData.apikey);

            Assert.Throws <ArgumentException>(() => omdb.GetItemById(null));
            Assert.Throws <ArgumentException>(() => omdb.GetItemById(""));
            Assert.Throws <ArgumentException>(() => omdb.GetItemById(" "));

            Assert.Throws <HttpRequestException>(() => omdb.GetItemById("wrongID"));
        }
Esempio n. 2
0
        public void TestGetItemByIdGood()
        {
            var omdb  = new OmdbClient(TestData.apikey);
            var movie = omdb.GetItemById("tt0076759", 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: The Last Jedi", 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("movie", movie.Type);
            Assert.Equal("21 Sep 2004", movie.Dvd);
            Assert.Equal("N/A", movie.BoxOffice);
            Assert.Equal("20th Century Fox", movie.Production);
            Assert.Equal("http://www.starwars.com/episode-iv/", movie.Website);
            Assert.Equal("True", movie.Response);
        }
Esempio n. 3
0
 public Item GetItem(string id)
 {
     try
     {
         return(omdb.GetItemById(id));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Esempio n. 4
0
        public void TestGetItemByIdGood2()
        {
            var omdb = new OmdbClient(TestData.apikey, true);
            var game = omdb.GetItemById("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);
        }