Exemplo n.º 1
0
        private static IEnumerable <WebTestRequest> UploadPackage(WebTest test, PackageToUploadInternal packageToUpload)
        {
            var uploadRequest = AssertAndValidationHelper.GetHttpRequestForUrl(UrlHelper.UploadPageUrl);

            yield return(uploadRequest);

            var uploadPostRequest = AssertAndValidationHelper.GetUploadPostRequestForPackage(test, packageToUpload.FullPath);

            yield return(uploadPostRequest);

            // This second get request to upload is to put us on the new "Verify Page" which is just the upload page in a different state.
            // This is to get the RequestVerificationToken for the following request. (upload and verify were merged onto the same page).
            var uploadRequest2 = AssertAndValidationHelper.GetHttpRequestForUrl(UrlHelper.UploadPageUrl);

            yield return(uploadRequest2);

            var verifyUploadPostRequest = AssertAndValidationHelper.GetVerifyPackagePostRequestForPackage(test,
                                                                                                          packageToUpload.Id,
                                                                                                          packageToUpload.Version,
                                                                                                          UrlHelper.GetPackagePageUrl(packageToUpload.Id, packageToUpload.Version),
                                                                                                          packageToUpload.Id,
                                                                                                          packageToUpload.Owner);

            yield return(verifyUploadPostRequest);
        }
Exemplo n.º 2
0
        private static IEnumerable <WebTestRequest> UploadPackage(WebTest test, PackageToUploadInternal packageToUpload)
        {
            // Navigate to the upload page.
            var uploadRequest = AssertAndValidationHelper.GetHttpRequestForUrl(UrlHelper.UploadPageUrl);

            yield return(uploadRequest);

            // Cancel any pending uploads.
            // We can't upload the new package if any uploads are pending.
            var cancelUploadPostRequest = AssertAndValidationHelper.GetCancelUploadPostRequestForPackage(test);

            yield return(cancelUploadPostRequest);

            // Upload the new package.
            var uploadPostRequest = AssertAndValidationHelper.GetUploadPostRequestForPackage(test, packageToUpload.FullPath);

            yield return(uploadPostRequest);

            // Verify the new package.
            var verifyUploadPostRequest = AssertAndValidationHelper.GetVerifyPackagePostRequestForPackage(test,
                                                                                                          packageToUpload.Id,
                                                                                                          packageToUpload.Version,
                                                                                                          UrlHelper.GetPackagePageUrl(packageToUpload.Id, packageToUpload.Version),
                                                                                                          packageToUpload.Id,
                                                                                                          packageToUpload.Owner);

            yield return(verifyUploadPostRequest);
        }