コード例 #1
0
ファイル: Plugin.cs プロジェクト: antwa/MangaRipper
        public async Task Batoto_Test()
        {
            var configMock = new Mock <IConfiguration>();

            configMock.Setup(c => c.FindConfigByPrefix(It.IsAny <string>())).Returns(new[] {
                new KeyValuePair <string, object>("Plugin.Batoto.Username", "gufrohepra"),
                new KeyValuePair <string, object>("Plugin.Batoto.Password", "123"),
                new KeyValuePair <string, object>("Plugin.Batoto.Languages", "")
            });

            string url     = "http://bato.to/comic/_/comics/21st-century-boys-r1591";
            var    service = new Batoto(configMock.Object, _logger, new Downloader(_logger), new HtmlAtilityPackAdapter());

            var chapters = await service.FindChapters(url, new Progress <int>(), _source.Token);

            Assert.IsTrue(chapters.Any(), "Cannot find chapters.");
            var chapter = chapters.Last();

            Assert.AreEqual("21st Century Boys", chapter.Manga);
            Assert.AreEqual("Vol.01 Ch.01 Read Online", chapter.DisplayName);
            Assert.AreEqual("https://bato.to/reader#900d11d96d1466f2", chapter.Url);
            var images = await service.FindImages(chapter, new Progress <int>(), _source.Token);

            Assert.AreEqual(31, images.Count());
            Assert.IsTrue(images.ToArray()[0].StartsWith("http://img.bato.to/comics/2014/10/08/2/read54357eb5e1ca9/img000001.jpg"));
            Assert.IsTrue(images.ToArray()[1].StartsWith("http://img.bato.to/comics/2014/10/08/2/read54357eb5e1ca9/img000002.jpg"));
            Assert.IsTrue(images.ToArray()[2].StartsWith("http://img.bato.to/comics/2014/10/08/2/read54357eb5e1ca9/img000003.jpg"));

            string imageString = await downloader.DownloadStringAsync(images.ToArray()[0], _source.Token);

            Assert.IsNotNull(imageString, "Cannot download image!");
        }
コード例 #2
0
ファイル: Plugin.cs プロジェクト: antwa/MangaRipper
        public async Task Batoto_GermanEnglishLanguages_Test()
        {
            var configMock = new Mock <IConfiguration>();

            configMock.Setup(c => c.FindConfigByPrefix(It.IsAny <string>())).Returns(new[] {
                new KeyValuePair <string, object>("Plugin.Batoto.Username", "gufrohepra"),
                new KeyValuePair <string, object>("Plugin.Batoto.Password", "123"),
                new KeyValuePair <string, object>("Plugin.Batoto.Languages", "German, English")
            });
            string url     = "https://bato.to/comic/_/comics/bitter-virgin-r110";
            var    service = new Batoto(configMock.Object, _logger, new Downloader(_logger), new HtmlAtilityPackAdapter());

            var chapters = await service.FindChapters(url, new Progress <int>(), _source.Token);

            Assert.AreEqual(32 + 32, chapters.Count());
        }