Exemplo n.º 1
0
        public void Test_RequestItem_MovieParse2()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\movie_her_scraped.txt");

            MovieRequestItem item = new MovieRequestItem("1", "moonlight", "");

            item.UrlImagePath = new Dictionary <string, string>();
            IMetacriticData mItem = item.Parse(new UrlResponsePair("url", testData));

            Assert.AreEqual(((Movie)mItem).Title, "Her");
            Assert.AreEqual(((Movie)mItem).Director, "Spike Jonze");
            Assert.AreEqual(((Movie)mItem).Rating.CriticRating, 90);
            Assert.AreEqual(((Movie)mItem).Rating.CriticReviewCount, 46);
            Assert.AreEqual(((Movie)mItem).Rating.UserRating, 8.6f);
            Assert.AreEqual(((Movie)mItem).Rating.UserReviewCount, 1376);
        }
Exemplo n.º 2
0
        public void Test_RequestItem_MovieParse3()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\movie_thewolfofwallstreet_scraped.txt");

            MovieRequestItem item = new MovieRequestItem("1", "the wolf of wall street", "");

            item.UrlImagePath = new Dictionary <string, string>();
            IMetacriticData mItem = item.Parse(new UrlResponsePair("url", testData));

            Assert.AreEqual(((Movie)mItem).Title, "The Wolf of Wall Street");
            Assert.AreEqual(((Movie)mItem).Director, "Martin Scorsese");
            Assert.AreEqual(((Movie)mItem).Rating.CriticRating, 75);
            Assert.AreEqual(((Movie)mItem).Rating.CriticReviewCount, 47);
            Assert.AreEqual(((Movie)mItem).Rating.UserRating, 6.8f);
            Assert.AreEqual(((Movie)mItem).Rating.UserReviewCount, 1856);
        }
Exemplo n.º 3
0
        public void Test_RequestItem_MovieParseWithDetails()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\movie_zerodarkthirty_details.txt");

            MovieRequestItem item  = new MovieRequestItem("1", "zero dark thirty", "", "details");
            IMetacriticData  mItem = item.Parse(new UrlResponsePair("url", testData));

            Assert.AreEqual(((MediaDetail)mItem).Details.Count, 8);
            CollectionAssert.Contains(((MediaDetail)mItem).Details,
                                      new DetailItem("Runtime", "157 min"));
            CollectionAssert.Contains(((MediaDetail)mItem).Credits,
                                      new MediaCredit("Jessica Chastain", "Maya"));
            CollectionAssert.Contains(((MediaDetail)mItem).Credits,
                                      new MediaCredit("Nabil Elouahabi", "Detainee On Monitor"));
            CollectionAssert.Contains(((MediaDetail)mItem).Credits,
                                      new MediaCredit("Jonathan Leven", "Co-Producer"));
        }
Exemplo n.º 4
0
        public void Test_RequestItem_MovieParse()
        {
            var    dir           = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData_2016 = File.ReadAllText(dir + @"\TestData\movie_moonlight_2016_scraped.txt");

            MovieRequestItem item = new MovieRequestItem("1", "moonlight", "");

            item.UrlImagePath = new Dictionary <string, string>();
            item.UrlImagePath.Add(@"\movie\moonlight", "tempmovie.jpg");
            IMetacriticData mItem = item.Parse(new UrlResponsePair(@"\movie\moonlight", testData_2016));

            Assert.AreEqual(((Movie)mItem).Title, "Moonlight");
            Assert.AreEqual(((Movie)mItem).Director, "Barry Jenkins");
            Assert.AreEqual(((Movie)mItem).Rating.CriticRating, 99);
            Assert.AreEqual(((Movie)mItem).Rating.CriticReviewCount, 51);
            Assert.AreEqual(((Movie)mItem).Rating.UserRating, 7.2f);
            Assert.AreEqual(((Movie)mItem).Rating.UserReviewCount, 994);
            Assert.AreEqual(((Movie)mItem).ImageUrl, "tempmovie.jpg");
        }