public async Task DownloadResume()
        {
            using var testFile = new TempFile();
            using var server   = new CrappyRandomServer();
            var state = new HTTPDownloader.State($"http://localhost:{server.Port}/foo");

            await state.Download(testFile.Path);

            Assert.Equal(server.Data, await testFile.Path.ReadAllBytesAsync());

            testFile.Path.Delete();
        }
Пример #2
0
        public async Task DownloadResume()
        {
            using (var server = new CrappyRandomServer())
            {
                var downloader = DownloadDispatcher.GetInstance <HTTPDownloader>();
                var state      = new HTTPDownloader.State {
                    Url = $"http://localhost:{server.Port}/foo"
                };

                await state.Download("test.resume_file");

                CollectionAssert.AreEqual(server.Data, File.ReadAllBytes("test.resume_file"));

                if (File.Exists("test.resume_file"))
                {
                    File.Delete("test.resume_file");
                }
            }
        }