예제 #1
0
 public async Task UploadPackageIfNecessary(string packageName, string version)
 {
     if (!PackageExists(packageName, version))
     {
         await _clientSdkHelper.UploadNewPackageAndVerify(packageName, version);
     }
 }
예제 #2
0
        public async Task FindPackagesByIdTest()
        {
            // Temporary workaround for the SSL issue, which keeps the upload test from working with cloudapp.net sites
            if (UrlHelper.BaseUrl.Contains("nugettest.org") || UrlHelper.BaseUrl.Contains("nuget.org"))
            {
                string packageId = string.Format("TestV2FeedFindPackagesById.{0}", DateTime.UtcNow.Ticks);

                TestOutputHelper.WriteLine("Uploading package '{0}'", packageId);
                await _clientSdkHelper.UploadNewPackageAndVerify(packageId);

                TestOutputHelper.WriteLine("Uploaded package '{0}'", packageId);

                await _clientSdkHelper.UploadNewPackageAndVerify(packageId, "2.0.0");

                string   url           = UrlHelper.V2FeedRootUrl + @"/FindPackagesById()?id='" + packageId + "'";
                string[] expectedTexts =
                {
                    @"<id>" + UrlHelper.V2FeedRootUrl + "Packages(Id='" + packageId + "',Version='1.0.0')</id>",
                    @"<id>" + UrlHelper.V2FeedRootUrl + "Packages(Id='" + packageId + "',Version='2.0.0')</id>"
                };
                var containsResponseText = await _odataHelper.ContainsResponseText(url, expectedTexts);

                Assert.True(containsResponseText);
            }
        }
예제 #3
0
        public async Task UploadAndUnlistPackagesAsSelf()
        {
            // Can push new package ID as self
            var id = UploadHelper.GetUniquePackageId(nameof(UploadAndUnlistPackagesAsSelf));
            await _clientSdkHelper.UploadNewPackageAndVerify(id, "1.0.0");

            // Can push new version of an existing package as self
            await _clientSdkHelper.UploadNewPackageAndVerify(id, "2.0.0");

            // Can unlist versions of an existing package as self
            await _clientSdkHelper.UnlistPackageAndVerify(id, "2.0.0");
        }
예제 #4
0
        public async Task UploadMultipleVersionOfPackage()
        {
            var packageId = string.Format("TestMultipleVersion.{0}", DateTime.Now.Ticks);

            await _clientSdkHelper.UploadNewPackageAndVerify(packageId);

            await _clientSdkHelper.UploadNewPackageAndVerify(packageId, "2.0.0");

            int actualCount = _clientSdkHelper.GetVersionCount(packageId);

            var userMessage = string.Format(" 2 versions of package {0} not found after uploading. Actual versions found {1}", packageId, actualCount);

            Assert.True(actualCount.Equals(2), userMessage);
        }
 public async Task UploadPackageWithNuGetCommandLineTest()
 {
     if (UrlHelper.BaseUrl.Contains("nugettest.org") || UrlHelper.BaseUrl.Contains("nuget.org"))
     {
         await _clientSdkHelper.UploadNewPackageAndVerify(DateTime.Now.Ticks.ToString());
     }
 }
예제 #6
0
        public async Task FindPackagesByIdTest()
        {
            if (CanUploadToSite())
            {
                string packageId = string.Format("TestV2FeedFindPackagesById.{0}", DateTime.UtcNow.Ticks);

                TestOutputHelper.WriteLine("Uploading package '{0}'", packageId);
                await _clientSdkHelper.UploadNewPackageAndVerify(packageId);

                TestOutputHelper.WriteLine("Uploaded package '{0}'", packageId);
                await _clientSdkHelper.UploadNewPackageAndVerify(packageId, "2.0.0");

                string   url           = UrlHelper.V2FeedRootUrl + @"/FindPackagesById()?id='" + packageId + "'";
                string[] expectedTexts =
                {
                    @"<id>" + UrlHelper.V2FeedRootUrl + "Packages(Id='" + packageId + "',Version='1.0.0')</id>",
                    @"<id>" + UrlHelper.V2FeedRootUrl + "Packages(Id='" + packageId + "',Version='2.0.0')</id>"
                };
                var containsResponseText = await _odataHelper.ContainsResponseText(url, expectedTexts);

                Assert.True(containsResponseText);
            }
        }
예제 #7
0
 public async Task UploadPackageWithNuGetCommandLineTest()
 {
     await _clientSdkHelper.UploadNewPackageAndVerify(DateTime.Now.Ticks.ToString());
 }