示例#1
0
        public void Test_RequestItem_RetrieveImagePath()
        {
            MovieRequestItem item = new MovieRequestItem("1", "moonlight", "");
            var    dir            = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData       = File.ReadAllText(dir + @"\TestData\movie_moonlight_autosearch.txt");

            item.AutoResult = JsonConvert.DeserializeObject <RootObject>(testData).AutoComplete.Results;
            item.FilterValidUrls();
            item.RetrieveImagePath();

            Assert.AreEqual(item.UrlImagePath["/movie/moonlight"],
                            @"http://static.metacritic.com/images/products/movies/5/f297a665fd50e664244005952493fbd0-98.jpg");
        }
示例#2
0
        public void Test_RequestItem_MovieFilterValidUrls()
        {
            var    dir          = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string testData     = File.ReadAllText(dir + @"\TestData\movie_the_master_autosearch.txt");
            var    completeData = Newtonsoft.Json.JsonConvert.DeserializeObject <RootObject>(testData);

            MovieRequestItem item = new MovieRequestItem("1", "the master", "");

            item.AutoResult = completeData.AutoComplete.Results;
            bool result = item.FilterValidUrls();

            Assert.AreEqual(item.Urls.Count, 1);
            Assert.IsTrue(result);
        }