/// <summary>
 /// Downloads a package to local folder and see if the download is successful. Used to individual tests which extend the download scenarios.
 /// </summary>
 /// <param name="packageId"></param>
 public static void DownloadPackageAndVerify(string packageId, string version = "1.0.0")
 {
     ClientSDKHelper.ClearMachineCache();
     ClientSDKHelper.ClearLocalPackageFolder(packageId);
     new PackageManager(PackageRepositoryFactory.Default.CreateRepository(UrlHelper.V2FeedRootUrl), Environment.CurrentDirectory).InstallPackage(packageId, new SemanticVersion(version));
     Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionInstalled(packageId, version), "Package install failed. Either the file is not present on disk or it is corrupted. Check logs for details");
 }
예제 #2
0
 public void RestorePackageFromV2Feed()
 {
     ClientSDKHelper.ClearMachineCache(); //clear local cache.
     try
     {
         string        packageId    = Constants.TestPackageId; //the package name shall be fixed as it really doesnt matter which package we are trying to install.
         string        version      = "1.0.0";
         Task <string> downloadTask = ODataHelper.DownloadPackageFromFeed(packageId, version, "Restore");
         string        filename     = downloadTask.Result;
         //check if the file exists.
         Assert.IsTrue(File.Exists(filename), " Package restore from V2 feed didnt work");
         string downloadedPackageId = ClientSDKHelper.GetPackageIdFromNupkgFile(filename);
         //Check that the downloaded Nupkg file is not corrupt and it indeed corresponds to the package which we were trying to download.
         Assert.IsTrue(downloadedPackageId.Equals(packageId), "Unable to unzip the package restored via V2 Feed. Check log for details");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
 }
예제 #3
0
 public void DownloadPackageFromV2Feed()
 {
     ClientSDKHelper.ClearMachineCache(); //clear local cache.
     try
     {
         string        packageId    = Constants.TestPackageId; //try to down load a pre-defined test package.
         string        version      = "1.0.0";
         Task <string> downloadTask = DownloadPackage(packageId, version);
         string        filename     = downloadTask.Result;
         //check if the file exists.
         Assert.IsTrue(File.Exists(filename), " Package download from V2 feed didnt work");
         string downloadedPackageId = ClientSDKHelper.GetPackageIdFromNupkgFile(filename);
         //Check that the downloaded Nupkg file is not corrupt and it indeed corresponds to the package which we were trying to download.
         Assert.IsTrue(downloadedPackageId.Equals(packageId), "Unable to unzip the package downloaded via V2 feed. Check log for details");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
 }
예제 #4
0
 public void TestInit()
 {
     //Clear the machine cache during the start of every test to make sure that we always hit the gallery         .
     ClientSDKHelper.ClearMachineCache();
 }