/// <summary>
 /// Clears the local package folder.
 /// </summary>
 public static void ClearLocalPackageFolder(string packageId)
 {
     string packageVersion = ClientSDKHelper.GetLatestStableVersion(packageId);
     string expectedDownloadedNupkgFileName = packageId + "." + packageVersion;
     string pathToNupkgFolder = Path.Combine(Environment.CurrentDirectory, expectedDownloadedNupkgFileName);
     Console.WriteLine("Path to the downloaded Nupkg file for clearing local package folder is: " + pathToNupkgFolder);
     if(Directory.Exists(pathToNupkgFolder))
         Directory.Delete(expectedDownloadedNupkgFileName, true);
 }
        /// <summary>
        /// Clears the local package folder.
        /// </summary>
        public static void ClearLocalPackageFolder(string packageId)
        {
            string packageVersion = ClientSDKHelper.GetLatestStableVersion(packageId);
            string expectedDownloadedNupkgFileName = packageId + "." + packageVersion;

            if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, expectedDownloadedNupkgFileName)))
            {
                Directory.Delete(expectedDownloadedNupkgFileName, true);
            }
        }
示例#3
0
 public static void DownloadPackageFromV2FeedWithOperation(string packageId, string version, string operation)
 {
     try
     {
         Task <string> downloadTask = ODataHelper.DownloadPackageFromFeed(packageId, version, operation);
         string        filename     = downloadTask.Result;
         //check if the file exists.
         Assert.IsTrue(File.Exists(filename), Constants.PackageDownloadFailureMessage);
         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), Constants.UnableToZipError);
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message);
     }
 }
 /// <summary>
 /// Given a package checks if it that version of the package is installed.
 /// </summary>
 /// <param name="packageId"></param>
 /// <returns></returns>
 public static bool CheckIfPackageVersionInstalled(string packageId, string packageVersion)
 {
     //string packageVersion = ClientSDKHelper.GetLatestStableVersion(packageId);
     string expectedDownloadedNupkgFileName = packageId + "." + packageVersion;
     //check if the nupkg file exists on the expected path post install
     string expectedNupkgFilePath = Path.Combine(Environment.CurrentDirectory, expectedDownloadedNupkgFileName, expectedDownloadedNupkgFileName + ".nupkg");
     Console.WriteLine("The expected Nupkg file path after package install is: " + expectedNupkgFilePath);
     if ((!File.Exists(expectedNupkgFilePath)))
     {
         Console.WriteLine(" Package file {0} not present after download", expectedDownloadedNupkgFileName);
         return false;
     }
     string downloadedPackageId = ClientSDKHelper.GetPackageIdFromNupkgFile(expectedNupkgFilePath);
     //Check that the downloaded Nupkg file is not corrupt and it indeed corresponds to the package which we were trying to download.
     if (!(downloadedPackageId.Equals(packageId)))
     {
         Console.WriteLine("Unable to unzip the package downloaded via Nuget Core. Check log for details");
         return false;
     }
     return true;
 }
        /// <summary>
        /// Given a package checks if it is installed properly in the current dir.
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public static bool CheckIfPackageInstalled(string packageId)
        {
            string packageVersion = ClientSDKHelper.GetLatestStableVersion(packageId);

            return(CheckIfPackageVersionInstalled(packageId, packageVersion));
        }