示例#1
0
        public void TestPathless()
        {
            // act
            Action act = () => DownloadBuilder.New().WithUrl(url).Build();

            // assert
            Assert.ThrowsException <ArgumentNullException>(act);
        }
示例#2
0
        public void TestUrlless()
        {
            // act
            Action act = () => DownloadBuilder.New().WithFileLocation(path).Build();

            // assert
            Assert.ThrowsException <ArgumentNullException>(act);
        }
示例#3
0
        public void TestSetName()
        {
            // act
            IDownload download = DownloadBuilder.New()
                                 .WithUrl(url)
                                 .WithFileLocation(path)
                                 .WithFileName(filename)
                                 .Build();

            // assert
            Assert.AreEqual(folder, download.Folder);
            Assert.AreEqual(filename, download.Filename);
        }
示例#4
0
        public void TestSetFolderAndName()
        {
            // act
            IDownload download = DownloadBuilder.New()
                                 .WithUrl(url)
                                 .WithDirectory(folder)
                                 .WithFileName(filename)
                                 .Build();

            // assert
            Assert.AreEqual(folder, download.Folder);
            Assert.AreEqual(filename, download.Filename);
        }
示例#5
0
        public void TestSetFolder()
        {
            // arrange
            var dir = Path.GetTempPath();

            // act
            IDownload download = DownloadBuilder.New()
                                 .WithUrl(url)
                                 .WithDirectory(dir)
                                 .Build();

            // assert
            Assert.AreEqual(dir, download.Folder);
            Assert.IsNull(download.Filename);
        }
示例#6
0
        public void TestCorrect()
        {
            // act
            IDownload download = DownloadBuilder.New()
                                 .WithUrl(url)
                                 .WithFileLocation(path)
                                 .Configure(config => {
                config.ParallelDownload = true;
            })
                                 .Build();

            // assert
            Assert.AreEqual(folder, download.Folder);
            Assert.AreEqual(filename, download.Filename);
        }