Exemple #1
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;
        }
        public override IEnumerator <WebTestRequest> GetRequestEnumerator()
        {
            //Use a predefined test package.
            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.
            ValidationRuleFindText packageTitleValidationRule = AssertAndValidationHelper.GetValidationRuleForFindText(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;
        }