public DownloadAsync ( |
||
uri | ||
outputFile | string | |
Результат | Task |
public void Exec(SubCommandRunningContext context) { var builder = new XRefArchiveBuilder(); Uri uri; if (Uri.TryCreate(_options.Uri, UriKind.RelativeOrAbsolute, out uri)) { builder.DownloadAsync(uri, _options.ArchiveFile).Wait(); } else { Logger.LogError($"Invalid uri: {_options.Uri}"); } }
public async Task TestDownload() { const string ZipFile = "test.zip"; var builder = new XRefArchiveBuilder(); Assert.True(await builder.DownloadAsync(new Uri("http://dotnet.github.io/docfx/xrefmap.yml"), ZipFile)); using (var xar = XRefArchive.Open(ZipFile, XRefArchiveMode.Read)) { var map = xar.GetMajor(); Assert.True(map.HrefUpdated); Assert.True(map.Sorted); Assert.NotNull(map.References); Assert.Null(map.Redirections); } File.Delete(ZipFile); }