예제 #1
0
        public override IEnumerator <WebTestRequest> GetRequestEnumerator()
        {
            WebTestRequest uploadPackageRequest = new WebTestRequest(UrlHelper.UploadPageUrl);

            uploadPackageRequest.ExpectedResponseUrl = UrlHelper.LogonPageUrlOnPackageUpload;
            ValidateHtmlTagInnerText logOnFormValidationRule = AssertAndValidationHelper.GetValidationRuleForHtmlTagInnerText(HtmlTextWriterTag.Label.ToString(), HtmlTextWriterAttribute.For.ToString(), "SignIn_UserNameOrEmail", "Username or Email");

            uploadPackageRequest.ValidateResponse += new EventHandler <ValidationEventArgs>(logOnFormValidationRule.Validate);
            yield return(uploadPackageRequest);

            uploadPackageRequest = null;
        }
 public static ValidateHtmlTagInnerText GetValidationRuleForHtmlTagInnerText(string tagName, string attributeName, string attributeValue, string innerText)
 {
     ValidateHtmlTagInnerText text = new ValidateHtmlTagInnerText();
     text.TagName = tagName;
     text.AttributeName = attributeName;
     text.AttributeValue = attributeValue;
     text.ExpectedInnerText = innerText;
     text.RemoveInnerTags = true;
     text.HasClosingTags = true;
     text.CollapseWhiteSpace = true;
     text.Index = -1;
     text.IgnoreCase = true;
     return text;
 }
        public static ValidateHtmlTagInnerText GetValidationRuleForHtmlTagInnerText(string tagName, string attributeName, string attributeValue, string innerText)
        {
            ValidateHtmlTagInnerText text = new ValidateHtmlTagInnerText();

            text.TagName            = tagName;
            text.AttributeName      = attributeName;
            text.AttributeValue     = attributeValue;
            text.ExpectedInnerText  = innerText;
            text.RemoveInnerTags    = true;
            text.HasClosingTags     = true;
            text.CollapseWhiteSpace = true;
            text.Index      = -1;
            text.IgnoreCase = true;
            return(text);
        }
        public override IEnumerator <WebTestRequest> GetRequestEnumerator()
        {
            WebTestRequest statsPageRequest = new WebTestRequest(UrlHelper.StatsPageUrl);

            //Checks for the prescene of a link to jqeury package. It is harded to Jquery for now as there is no API exposed for stats
            //and also Jquery is going to be one of the top 10 for now.
            ValidateHtmlTagInnerText jQueryPackageValidationRule = AssertAndValidationHelper.GetValidationRuleForHtmlTagInnerText(HtmlTextWriterTag.A.ToString(), HtmlTextWriterAttribute.Href.ToString(), "/packages/jQuery/", "jQuery");

            statsPageRequest.ValidateResponse += new EventHandler <ValidationEventArgs>(jQueryPackageValidationRule.Validate);
            //validation rule to check for the default text in stats page.
            ValidationRuleFindText StatsPageDefaultTextValidationRule = AssertAndValidationHelper.GetValidationRuleForFindText(Constants.StatsPageDefaultText);

            statsPageRequest.ValidateResponse += new EventHandler <ValidationEventArgs>(StatsPageDefaultTextValidationRule.Validate);

            yield return(statsPageRequest);

            statsPageRequest = null;
        }
예제 #5
0
        public override IEnumerator <WebTestRequest> GetRequestEnumerator()
        {
            // take package names from the data source
            string         packageId          = Constants.TestPackageId;
            WebTestRequest 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.
            ValidateHtmlTagInnerText packageTitleValidationRule = AssertAndValidationHelper.GetValidationRuleForHtmlTagInnerText(HtmlTextWriterTag.Title.ToString(), string.Empty, string.Empty, "NuGet Gallery | " + packageId + " " + ClientSDKHelper.GetLatestStableVersion(packageId));

            packagePageRequest.ValidateResponse += new EventHandler <ValidationEventArgs>(packageTitleValidationRule.Validate);
            //rule to check that the download count is present in the response.
            ValidationRuleFindText downloadCountValidationRule = AssertAndValidationHelper.GetValidationRuleForFindText(ClientSDKHelper.GetFormattedDownLoadStatistics(packageId));

            packagePageRequest.ValidateResponse += new EventHandler <ValidationEventArgs>(downloadCountValidationRule.Validate);

            yield return(packagePageRequest);

            packagePageRequest = null;
        }