Exemple #1
0
        public async Task DownloadPackage()
        {
            string packageId = Constants.TestPackageId; //try to download a pre-defined test package.

            _clientSdkHelper.ClearLocalPackageFolder(packageId, ClientSdkHelper.GetLatestStableVersion(packageId));

            var result = await _commandlineHelper.InstallPackageAsync(packageId, UrlHelper.V2FeedRootUrl, Environment.CurrentDirectory);

            Assert.True(result.ExitCode == 0, Constants.PackageDownloadFailureMessage);
            Assert.True(_clientSdkHelper.CheckIfPackageInstalled(packageId), Constants.PackageInstallFailureMessage);
        }
        public async Task DownloadPackageWithNuGetCommandLineTest()
        {
            // Temporary work around for the SSL issue, which keeps the upload tests from working on sites with cloudapp.net
            if (UrlHelper.BaseUrl.Contains("nugettest.org") || UrlHelper.BaseUrl.Contains("nuget.org"))
            {
                string packageId = Constants.TestPackageId; //try to download a pre-defined test package.
                _clientSdkHelper.ClearLocalPackageFolder(packageId, ClientSdkHelper.GetLatestStableVersion(packageId));

                var result = await _commandlineHelper.InstallPackageAsync(packageId, UrlHelper.V2FeedRootUrl, Environment.CurrentDirectory);

                Assert.True(result.ExitCode == 0, Constants.PackageDownloadFailureMessage);
                Assert.True(_clientSdkHelper.CheckIfPackageInstalled(packageId), Constants.PackageInstallFailureMessage);
            }
        }
Exemple #3
0
        public override IEnumerator <WebTestRequest> GetRequestEnumerator()
        {
            // Use a predefined test package.
            var packageId          = Constants.TestPackageId;
            var packagePageRequest = new WebTestRequest(UrlHelper.BaseUrl + @"/Packages/" + packageId);

            // Rule to check if the title contains the package id and the latest stable version of the package.
            var packageTitleValidationRule = AssertAndValidationHelper.GetValidationRuleForFindText(packageId + " " + ClientSdkHelper.GetLatestStableVersion(packageId));

            packagePageRequest.ValidateResponse += packageTitleValidationRule.Validate;

            // Rule to check that the download count is present in the response.
            var downloadCountValidationRule = AssertAndValidationHelper.GetValidationRuleForFindText(ClientSdkHelper.GetFormattedDownLoadStatistics(packageId));

            packagePageRequest.ValidateResponse += downloadCountValidationRule.Validate;

            yield return(packagePageRequest);
        }