public void UploadAndDownLoadPackageWithMinClientVersion()
        {
            string packageId       = DateTime.Now.Ticks.ToString() + "PackageWithDotCsNames.Cs";
            string version         = "1.0.0";
            string packageFullPath = PackageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3");
            int    exitCode        = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl);

            Assert.IsTrue((exitCode == 0), Constants.UploadFailureMessage);
            Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), Constants.PackageNotFoundAfterUpload, packageId, UrlHelper.V2FeedRootUrl);

            //Delete package from local disk so once it gets uploaded
            if (File.Exists(packageFullPath))
            {
                File.Delete(packageFullPath);
                Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true);
            }
            AssertAndValidationHelper.DownloadPackageAndVerify(packageId);
        }
        [Ignore] //This method is marked ignore as we don't it to be run in regular runs. It will be run only when required.
        public void UploadAndDownLoadTestBombPackage()
        {
            string packageId       = DateTime.Now.Ticks.ToString() + testContextInstance.TestName;
            string version         = "1.0.0";
            string packageFullPath = PackageCreationHelper.CreateGalleryTestBombPackage(packageId);
            int    exitCode        = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl);

            Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream");
            Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.V2FeedRootUrl);

            //Delete package from local disk so once it gets uploaded
            if (File.Exists(packageFullPath))
            {
                File.Delete(packageFullPath);
                Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true);
            }

            AssertAndValidationHelper.DownloadPackageAndVerify(packageId);
        }
        /// <summary>
        /// Creates a package with the specified Id and Version and uploads it and checks if the upload has suceeded.
        /// This will be used by test classes which tests scenarios on top of upload.
        /// </summary>
        /// <param name="packageId"></param>
        /// <param name="version"></param>
        public static void UploadNewPackageAndVerify(string packageId, string version = "1.0.0")
        {
            if (string.IsNullOrEmpty(packageId))
            {
                packageId = DateTime.Now.Ticks.ToString();
            }
            string packageFullPath = PackageCreationHelper.CreatePackage(packageId, version);
            string standardOutput  = string.Empty;
            string standardError   = string.Empty;
            int    exitCode        = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl, out standardOutput, out standardError);

            Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream.  Exit Code: " + exitCode + ". Error message: \"" + standardError + "\"");
            Console.WriteLine(standardOutput);
            Console.WriteLine(standardError);
            Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.V2FeedRootUrl);

            //Delete package from local disk so once it gets uploaded
            if (File.Exists(packageFullPath))
            {
                File.Delete(packageFullPath);
                Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true);
            }
        }
 public bool PackageExists(string packageName, string version, string url)
 {
     return(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageName, version, url));
 }