Exemplo n.º 1
0
        public void ParsePointRssTest1()
        {
            string mylist_id = TestUtility.TestData[TestUtility.KEY_MYLIST_ID];
            string video_id = TestUtility.TestData[TestUtility.KEY_VIDEO_ID];
            string video_title = TestUtility.TestData[TestUtility.KEY_VIDEO_TITLE];
            string video_description = TestUtility.TestData[TestUtility.KEY_VIDEO_DESCRIPTION];
            DateTime video_submit_date = DateTime.Parse(TestUtility.TestData[TestUtility.KEY_VIDEO_SUBMIT_DATE]);
            string video_length = TestUtility.TestData[TestUtility.KEY_VIDEO_LENGTH];

            TestUtility.EnsureLogin(network_);

            string rss = network_.GetMylistHtml(mylist_id, true);
            List<Video> video_list = new List<Video>();
            NicoListManager.ParsePointRss(rss, DateTime.Now, video_list, false, true);
            Assert.That(video_list.Count, Is.GreaterThanOrEqualTo(1), "ParsePointRssTest1-1");
            Video video = video_list[0];
            Assert.That(video.title, Is.EqualTo(video_title), "ParsePointRssTest1-x");
            Assert.That(video.video_id, Is.EqualTo(video_id), "ParsePointRssTest1-2");
            Assert.That(video.description, Is.EqualTo(video_description), "ParsePointRssTest1-4");
            Assert.That(video.submit_date, Is.EqualTo(video_submit_date), "ParsePointRssTest1-5");
            Assert.That(video.length, Is.EqualTo(video_length), "ParsePointRssTest1-6");
        }
Exemplo n.º 2
0
        public void ParsePointRssTest2()
        {
            int wait_milliseconds = int.Parse(TestUtility.TestData[TestUtility.KEY_ACCESS_WAIT_MILLISECONDS]);
            DirectoryInfo temp_dir = new DirectoryInfo(TestUtility.TestData[TestUtility.KEY_TEMP_DIRECTORY]);
            string video_title = "【初音ミク】みくみくにしてあげる♪【してやんよ】";

            Assert.That(TestUtility.InitDirectory(temp_dir), Is.True, "parsePointRssTest2-1");

            TestUtility.EnsureLogin(network_);

            DownloadKind download_kind = new DownloadKind();
            download_kind.SetFormatRss();
            download_kind.SetTarget(true, false, false);
            download_kind.SetDuration(true, false, false, false, false);
            download_kind.CategoryList = new List<CategoryItem>();
            CategoryItem category_item = new CategoryItem();
            category_item.id = "music";
            category_item.name = "音楽";
            category_item.page = new int[] { 3, 1, 1, 0 };
            category_item.short_name = "mus";
            download_kind.CategoryList.Add(category_item);

            network_.DownloadRanking(temp_dir.FullName, download_kind, wait_milliseconds);
            FileInfo rss_file = Array.Find(temp_dir.GetFiles(), delegate(FileInfo fi) {
                return fi.Name.StartsWith("tot_mus_vie_1_");
            });

            Assert.That(rss_file, Is.Not.Null, "ParsePointRssTest2-2");

            string rss = IJFile.ReadVer2(rss_file.FullName, IJFile.EncodingPriority.Auto);
            List<Video> video_list = new List<Video>();
            NicoListManager.ParsePointRss(rss, DateTime.Now, video_list, true, false);

            Assert.That(video_list.Count, Is.GreaterThanOrEqualTo(1), "ParsePointRssTest2-3");
            Assert.That(video_list[0].title, Is.EqualTo(video_title), "ParsePointRssTest2-4");
        }