Exemple #1
0
        public void Error_IfDestinationIsNull()
        {
            var i = new DownloadInput
            {
                DestinationPath = null,
                SearchPattern   = "*",
                S3Directory     = ""
            };

            var o = new DownloadOptions
            {
                DownloadFromCurrentDirectoryOnly = true,
                Overwrite             = true,
                ThrowErrorIfNoMatches = true,
                DeleteSourceFile      = false
            };

            List <string> TestDelegate()
            {
                return(DownloadTask.DownloadFiles(i, _param, o, new CancellationToken()));
            }

            Assert.That(TestDelegate,
                        Throws.TypeOf <ArgumentNullException>()
                        .With.Message.EndsWith($"{nameof(i.DestinationPath)}"));
        }
Exemple #2
0
        public static void TestDownloadInputParse()
        {
            var list = new List <string>
            {
                "1426111",
                "1426111/f31e10992f",
                "https://e-hentai.org/g/1426111/f31e10992f",
                "https://exhentai.org/g/1426111/f31e10992f",
                "https://e-hentai.org/g/1426111/f31e10992f/",
                "https://exhentai.org/g/1426111/f31e10992f/",
                "https://hitomi.la/galleries/1445130.html",
                "https://hitomi.la/reader/1262768.html",
                "https://hitomi.la/reader/1262768.html#1-"
            };

            foreach (var str in list)
            {
                var downloadInput = DownloadInput.Parse(str);
                Console.WriteLine("=================");
                Console.WriteLine(str);
                Console.WriteLine(downloadInput);
                Console.WriteLine();
            }
        }