winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

WinGetUtilDownload.cs (1285B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="WinGetUtilDownload.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace AppInstallerCLIE2ETests.WinGetUtil
      8 {
      9     using System.IO;
     10     using System.Linq;
     11     using AppInstallerCLIE2ETests.Helpers;
     12     using NUnit.Framework;
     13 
     14     /// <summary>
     15     /// Test winget util download.
     16     /// </summary>
     17     public class WinGetUtilDownload
     18     {
     19         /// <summary>
     20         /// Test download.
     21         /// </summary>
     22         [Test]
     23         public void WinGetUtil_Download()
     24         {
     25             uint hashSize = 32;
     26             byte[] sha256Hash = new byte[hashSize];
     27             string installerUrl = @"https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe";
     28             string filePath = TestCommon.GetRandomTestFile(".exe");
     29 
     30             // Download
     31             WinGetUtilWrapper.WinGetDownload(installerUrl, filePath, sha256Hash, hashSize);
     32 
     33             Assert.True(File.Exists(filePath));
     34             Assert.False(sha256Hash.All(byteVal => byteVal == 0));
     35         }
     36     }
     37 }