コード例 #1
0
        public void Test_RequestItem_AlbumParseWithDetails()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\album_teensofdenial_details.txt");

            AlbumRequestItem item  = new AlbumRequestItem("1", "teens of denial", "", "details");
            IMetacriticData  mItem = item.Parse(new UrlResponsePair("url", testData));

            Assert.AreEqual(((MediaDetail)mItem).Details.Count, 4);
            CollectionAssert.Contains(((MediaDetail)mItem).Details,
                                      new DetailItem("Record Label", "Matador"));
            CollectionAssert.Contains(((MediaDetail)mItem).Details,
                                      new DetailItem("Genre(s)", "Pop/Rock, Alternative/Indie Rock"));
            CollectionAssert.Contains(((MediaDetail)mItem).Details,
                                      new DetailItem("Name", "Car Seat Headrest"));
        }
コード例 #2
0
        public void Test_RequestItem_AlbumParse5()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData_20171103\album_midnite_vultures.txt");

            AlbumRequestItem item = new AlbumRequestItem("1", "Midnite Vultures", "");

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

            Assert.AreEqual(((Album)mItem).Title, "Midnite Vultures");
            Assert.AreEqual(((Album)mItem).PrimaryArtist, "Beck");
            Assert.AreEqual(((Album)mItem).Rating.CriticRating, 83);
            Assert.AreEqual(((Album)mItem).Rating.CriticReviewCount, 19);
            Assert.AreEqual(((Album)mItem).Rating.UserRating, 8.8f);
            Assert.AreEqual(((Album)mItem).Rating.UserReviewCount, 53);
        }
コード例 #3
0
        public void Test_RequestItem_AlbumParse4()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData_20171103\album_all_american_made.txt");

            AlbumRequestItem item = new AlbumRequestItem("1", "all american made", "");

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

            Assert.AreEqual(((Album)mItem).Title, "All American Made");
            Assert.AreEqual(((Album)mItem).PrimaryArtist, "Margo Price");
            Assert.AreEqual(((Album)mItem).Rating.CriticRating, 82);
            Assert.AreEqual(((Album)mItem).Rating.CriticReviewCount, 13);
            Assert.AreEqual(((Album)mItem).Rating.UserRating, 6.3f);
            Assert.AreEqual(((Album)mItem).Rating.UserReviewCount, 4);
        }
コード例 #4
0
        public void Test_RequestItem_AlbumParse3()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\album_aseatatthetable_scraped.txt");

            AlbumRequestItem item = new AlbumRequestItem("1", "a seat at the table", "");

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

            Assert.AreEqual(((Album)mItem).Title, "A Seat at the Table");
            Assert.AreEqual(((Album)mItem).PrimaryArtist, "Solange");
            Assert.AreEqual(((Album)mItem).Rating.CriticRating, 89);
            Assert.AreEqual(((Album)mItem).Rating.CriticReviewCount, 26);
            Assert.AreEqual(((Album)mItem).Rating.UserRating, 8.2f);
            Assert.AreEqual(((Album)mItem).Rating.UserReviewCount, 301);
        }
コード例 #5
0
        public void Test_RequestItem_AlbumParse2()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\album_melodrama_scraped.txt");

            AlbumRequestItem item = new AlbumRequestItem("1", "melodrama", "");

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

            Assert.AreEqual(((Album)mItem).Title, "Melodrama");
            Assert.AreEqual(((Album)mItem).PrimaryArtist, "Lorde");
            Assert.AreEqual(((Album)mItem).Rating.CriticRating, 91);
            Assert.AreEqual(((Album)mItem).Rating.CriticReviewCount, 33);
            Assert.AreEqual(((Album)mItem).Rating.UserRating, 9.0f);
            Assert.AreEqual(((Album)mItem).Rating.UserReviewCount, 1363);
        }
コード例 #6
0
        public void Test_RequestItem_AlbumParse()
        {
            var    dir      = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData = File.ReadAllText(dir + @"\TestData\album_lemonade_2016_scraped.txt");

            AlbumRequestItem item = new AlbumRequestItem("1", "lemonade", "");

            item.UrlImagePath = new Dictionary <string, string>();
            item.UrlImagePath.Add(@"\album\lemonade", "tempalbum.jpg");
            IMetacriticData mItem = item.Parse(new UrlResponsePair(@"\album\lemonade", testData));

            Assert.AreEqual(((Album)mItem).Title, "Lemonade");
            Assert.AreEqual(((Album)mItem).Rating.CriticRating, 92);
            Assert.AreEqual(((Album)mItem).Rating.CriticReviewCount, 33);
            Assert.AreEqual(((Album)mItem).Rating.UserRating, 7.7f);
            Assert.AreEqual(((Album)mItem).Rating.UserReviewCount, 2518);
            Assert.AreEqual(((Album)mItem).ImageUrl, "tempalbum.jpg");
        }