public void TestExecutionTimeout()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.STAGING, "true");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "agileville-78B2EF7DE83644CAB5F8C72F2D8C8491");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "2");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();
            bvParameters.UserAgent = "NORMAL_USER OR Browser userAgent";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "data-gen-7k694zcnd6gbnpv2v4e6mmd22";

            String theUiContent = uiContent.getContent(bvParameters);
            Assert.IsTrue(theUiContent.Contains("getContent"), "there should be getContent word/message");
            Assert.IsTrue(theUiContent.Contains("Execution timed out, exceeded"), 
                "there should be execution timeout message");

            uiContent = new BVManagedUIContent(bvConfig);
            theUiContent = uiContent.getReviews(bvParameters);
            Assert.IsTrue(theUiContent.Contains("getReviews"), "there should be getReviews word/message");
            Assert.IsTrue(theUiContent.Contains("Execution timed out, exceeded"),
                "there should be execution timeout message");

            uiContent = new BVManagedUIContent(bvConfig);
            theUiContent = uiContent.getAggregateRating(bvParameters);
            Debug.WriteLine(theUiContent);
            Assert.IsTrue(theUiContent.Contains("getAggregateRating"), "there should be getAggregateRating word/message");
            Assert.IsTrue(theUiContent.Contains(" Execution timed out, exceeded"),
                "there should be execution timeout message");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Helper helper = new Helper(Page.Request);
     BVSdkConfiguration config = helper.GetConfiguration("myshco-3e3001e88d9c32d19a17cafacb81bec7", "9344");
     BVParameters bvParams = helper.GetParams("5000001", "p", "re");
     BVManagedUIContent uiContent = new BVManagedUIContent(config);
     string summary = uiContent.getAggregateRating(bvParams);
     string reviews = uiContent.getReviews(bvParams);
     string content = uiContent.getContent(bvParams);
     bvrrSummaryContainer.InnerHtml = summary;
     bvrrReviewsContainer.InnerHtml = reviews;
     bvrrContentContainer.InnerHtml = content;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Helper helper = new Helper(Page.Request);
     BVSdkConfiguration config = helper.GetConfiguration("myshco-126b543c32d9079f120a575ece25bad6", "9344ia");
     BVParameters bvParams = helper.GetParams("5000001", "p", "sp");
     BVManagedUIContent uiContent = new BVManagedUIContent(config);
     config.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "12");
     bvParams.UserAgent = "google";
     bvParams.PageURI = Request.Url.ToString() + "?bvpage=ctsp/stp/pg2";
     string summary = uiContent.getAggregateRating(bvParams);
     string reviews = uiContent.getReviews(bvParams);
     string content = uiContent.getContent(bvParams);
     bvrrSummaryContainer.InnerHtml = summary;
     bvrrReviewsContainer.InnerHtml = reviews;
     bvrrContentContainer.InnerHtml = content;
 }
        public void TestSEOContentFromHTTP_SinglePagePRR_AggregateRating()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "3000");
            bvConfig.addProperty(BVClientConfig.STAGING, "true");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();
            bvParameters.UserAgent = "google";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "2000002";

            String theUIContent = uiContent.getAggregateRating(bvParameters);
            Console.WriteLine(theUIContent);
            Assert.AreEqual<Boolean>(theUIContent.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                true, "there should be BvRRSourceID in the content");
            Assert.AreEqual<Boolean>(!theUIContent.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                    "there should not be reviews section in the content");
        }
        private void loadData(
            String currentUrl,
            String contentType,
            int index,
            HtmlGenericControl reviewSummaryControl,
            HtmlGenericControl reviewControl,
            HtmlGenericControl contentControl
        )
        {
            String cloudKey = Request.QueryString["cloudkey" + index];
            String staging = Request.QueryString["staging" + index];
            String testing = Request.QueryString["testing" + index];
            String rootFolder = Request.QueryString["site" + index];
            String subjectType = Request.QueryString["subjecttype" + index];
            String subjectId = Request.QueryString["subjectid" + index];

            if (subjectType != null)
            {
                subjectType = BVSubjectType.subjectType(subjectType);
            }
            // Separate defaulting Logic for spotlight vs non-spotlight content
            if (contentType.Equals(BVContentType.SPOTLIGHTS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "category-1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "spotlight-four-746e2fc1211dc8964560350c9f28b67a";
                }
                if (staging == null)
                {
                    staging = "false";
                }
                if (testing == null)
                {
                    testing = "true";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Main_Site-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.CATEGORY;
                }
            }
            else if (contentType.Equals(BVContentType.REVIEWS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "product1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "spotlight-five-311f5a3337b8d5e0d817adb7af279b0a";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Other_Zone-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }
            else if (contentType.Equals(BVContentType.QUESTIONS, StringComparison.OrdinalIgnoreCase))
            {
                if (subjectId == null)
                {
                    subjectId = "data-gen-u2y505e9u1l65i43l6zz22ve6";
                }
                if (cloudKey == null)
                {
                    cloudKey = "agileville-78B2EF7DE83644CAB5F8C72F2D8C8491";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "Main_Site-en_US";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }
            else
            {
                if (subjectId == null)
                {
                    subjectId = "test1";
                }
                if (cloudKey == null)
                {
                    cloudKey = "Allergan-09b83694534c0d1bcd24851e9e9d172f";
                }
                if (staging == null)
                {
                    staging = "true";
                }
                if (testing == null)
                {
                    testing = "false";
                }
                if (rootFolder == null)
                {
                    rootFolder = "8183-en_us";
                }
                if (subjectType == null)
                {
                    subjectType = BVSubjectType.PRODUCT;
                }
            }

            // Setting up BVConfiguration and BVParameters
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, cloudKey);
            bvConfig.addProperty(BVClientConfig.STAGING, staging);
            bvConfig.addProperty(BVClientConfig.TESTING, testing);
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, rootFolder);
            bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");  // use this as a kill switch
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false"); // set to false if using cloud-based content
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");
            bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "yandex");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "1500");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT_BOT, "2000");

            var bvParameters = new BVParameters
            {
                BaseURI = currentUrl,
                PageURI = currentUrl,
                UserAgent = Request.UserAgent,
                ContentType = new BVContentType(contentType),
                SubjectType = new BVSubjectType(subjectType),
                SubjectId = subjectId
            };
            if (contentType.Equals(BVContentType.STORIES, StringComparison.OrdinalIgnoreCase))
            {
                bvParameters.ContentSubType = new BVContentSubType(BVContentSubType.STORIES_LIST);
            }

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);
            if (contentType.Equals(BVContentType.REVIEWS, StringComparison.OrdinalIgnoreCase))
            {
                reviewSummaryControl.InnerHtml = bvOutput.getAggregateRating(bvParameters);
                reviewControl.InnerHtml = bvOutput.getReviews(bvParameters);
                contentControl.InnerHtml = "";
            }
            else
            {
                contentControl.InnerHtml = bvOutput.getContent(bvParameters);
                reviewSummaryControl.InnerHtml = "";
                reviewControl.InnerHtml = "";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();

            String cloudKey = Request.QueryString["cloudkey"];
            String staging = Request.QueryString["staging"];
            String testing = Request.QueryString["testing"];
            String rootFolder = Request.QueryString["site"];
            String productIdParam = Request.QueryString["productid"];

            String subjectId = "5000001";

            if (cloudKey != null)
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, cloudKey);
            else
                bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-3e3001e88d9c32d19a17cafacb81bec7");
            if (staging != null)
                bvConfig.addProperty(BVClientConfig.STAGING, staging);
            else
                bvConfig.addProperty(BVClientConfig.STAGING, "true");
            if (testing != null)
                bvConfig.addProperty(BVClientConfig.TESTING, testing);
            else
                bvConfig.addProperty(BVClientConfig.TESTING, "false");

            if (rootFolder != null)
                bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, rootFolder);
            else
                bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "9344");

            if (productIdParam != null)
            {
                //if productIdParameter is null then use the default value.  If it's not null then use the parameter.  If category
                subjectId = productIdParam;
            }
            else
                subjectId = "5000001";

            bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");  // use this as a kill switch
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false"); // set to false if using cloud-based content
            bvConfig.addProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT, "/");

            bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "yandex");

            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "1500");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT_BOT, "2000");

            var bvParameters = new BVParameters
            {
                BaseURI =
                    Request.Url.ToString().Contains("?")
                        ? Request.Url.ToString().Substring(0, Request.Url.ToString().IndexOf("?"))
                        : Request.Url.ToString(),
                PageURI = Request.Url.ToString(),
                ContentType = new BVContentType(BVContentType.REVIEWS),
                SubjectType = new BVSubjectType(BVSubjectType.PRODUCT),
                SubjectId = subjectId
            };

            BVUIContent bvOutput = new BVManagedUIContent(bvConfig);
            BVRRSummaryContainer.InnerHtml = bvOutput.getAggregateRating(bvParameters);
            BVRRContainer.InnerHtml = bvOutput.getReviews(bvParameters);
        }
        public void TestAggregate_InvalidURL()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "adobe-invalid-55d020998d7b4776fb0f9df49278083c");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "8814");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "PR6";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                        "there should be error message for SubjectId");
            
            sBvOutputSummary = _bvOutput.getReviews(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                        "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getContent(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: The resource to the URL or file is currently unavailable.;</li>"),
                        "there should be error message for SubjectId");
        }
        public void TestAggregate_NullSubjectID()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "hartz-2605f8e4ef6790962627644cc195acf2");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "11568-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = null;

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"), 
						"there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getReviews(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"),
                        "there should be error message for SubjectId");

            sBvOutputSummary = _bvOutput.getContent(_bvParam);
            Assert.IsTrue(sBvOutputSummary.Contains("<li data-bvseo=\"ms\">bvseo-msg: SubjectId cannot be null or empty.;</li>"),
                        "there should be error message for SubjectId");
        }
        public void TestSEOContentFromHTTP_SinglePagePRR_CrawlerOverride()
        {
            BVConfiguration bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "totalgymdirect-f19e9cfeb9917d0c20afdfbe06483f1b");//"adobe-55d020998d7b4776fb0f9df49278083c");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");
            bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "mysearchbot");

            BVUIContent uiContent = new BVManagedUIContent(bvConfig);

            BVParameters bvParameters = new BVParameters();
            bvParameters.UserAgent = "111mysearchbot122";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "PRTG2000";

            String theUIContent = uiContent.getAggregateRating(bvParameters);
            Console.WriteLine(theUIContent);

            Assert.IsTrue(theUIContent.Contains("<div id=\"bvseo-aggregateRatingSection\" itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">"),
                 "there should be bvseo-aggregateRatingSection in the content");
            Assert.IsFalse(theUIContent.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">"),
                "there should not be reviews section in the content");

            /** Scenario for multiple crawler patterh **/
            bvConfig = new BVSdkConfiguration();
            bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "totalgymdirect-f19e9cfeb9917d0c20afdfbe06483f1b");
            bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");
            bvConfig.addProperty(BVClientConfig.CRAWLER_AGENT_PATTERN, "mysearchbot|anotherbot");

            uiContent = new BVManagedUIContent(bvConfig);

            bvParameters = new BVParameters();
            bvParameters.UserAgent = "111mysearchbot122";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "PRTG2000";

            theUIContent = uiContent.getAggregateRating(bvParameters);
            Console.WriteLine(theUIContent);
            Assert.IsTrue(theUIContent.Contains("<div id=\"bvseo-aggregateRatingSection\" itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">"),
                 "there should be bvseo-aggregateRatingSection in the content");
            Assert.IsFalse(theUIContent.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">"),
                "there should not be reviews section in the content");

            bvParameters = new BVParameters();
            bvParameters.UserAgent = "111anotherbot122";
            bvParameters.ContentType = new BVContentType(BVContentType.REVIEWS);
            bvParameters.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            bvParameters.SubjectId = "PRTG2000";

            theUIContent = uiContent.getAggregateRating(bvParameters);
            Console.WriteLine(theUIContent);
            Assert.IsTrue(theUIContent.Contains("<div id=\"bvseo-aggregateRatingSection\" itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">"),
                 "there should be bvseo-aggregateRatingSection in the content");
            Assert.IsFalse(theUIContent.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">"),
                "there should not be reviews section in the content");
        }
        public void TestSEOContent_SinglePageHTTP_GetAggregateRating_SDK_Disabled()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "false");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "hartz-2605f8e4ef6790962627644cc195acf2");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "11568-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "1577";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("<li data-bvseo=\"sdk\">"), true, "There should be footer");
            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("<!--begin-aggregate-rating-->"), false, "there should not be aggregateRating in the content");
        }
        public void TestSEOContent_SinglePageHTTP_Aggregate_WithoutPagination()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "totalgymdirect-f19e9cfeb9917d0c20afdfbe06483f1b");
            _bvConfig.addProperty(BVClientConfig.STAGING, "true");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "PRTG2000";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Console.WriteLine(sBvOutputSummary);

            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("<!--begin-aggregate-rating-->"), true, "there should be AggregateRating in the content");
            Assert.AreEqual<Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                    "there should not be reviews section in the content");
        }
        public void TestSEOContent_SinglePageHTTP_AggregateRating_IfNotPresent()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "seo_sdk_testcase-159b6108bb11967e554a92c6a3c39cb3");
            _bvConfig.addProperty(BVClientConfig.STAGING, "false");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "5000002_No_Aggr_Rating";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);
            Console.WriteLine(_bvOutput);
            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Console.WriteLine(sBvOutputSummary);
            Assert.AreEqual<Boolean>(!sBvOutputSummary.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                    true, "there should not be AggregateRating in the content");
            Assert.AreEqual<Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                    "there should not be reviews section in the content");
            String expectedMessage = BVMessageUtil.getMessage("ERR0012");
            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains(expectedMessage),
                true, "Message does not contain expected message please test");
        }
        public void TestSEOContent_SinglePageHTTP_GetReviews_ERR0013()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68"); //"adobe-55d020998d7b4776fb0f9df49278083c");
            _bvConfig.addProperty(BVClientConfig.STAGING, "true");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "300000");

            BVParameters _bvParam = new BVParameters();
            _bvParam.UserAgent = "googlebot";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm";
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "3000001";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);
            Console.WriteLine(sBvOutputSummary);
            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                true, "there should be AggregateRating in the content");
            Assert.AreEqual<Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                "there should not be reviews section in the content");

            String sBvOutputReviews = _bvOutput.getReviews(_bvParam);
            Assert.AreEqual<Boolean>(sBvOutputReviews.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true,
                    "there should be reviews section in the content");
            Assert.AreEqual<Boolean>(!sBvOutputReviews.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                    true, "there should not be AggregateRating in the content");
        }
        public void TestSEOContent_SinglePageHTTP_AggregateRating_BotDetected()
        {
            BVConfiguration _bvConfig = new BVSdkConfiguration();
            _bvConfig.addProperty(BVClientConfig.SEO_SDK_ENABLED, "true");
            _bvConfig.addProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY, "false");
            _bvConfig.addProperty(BVClientConfig.CLOUD_KEY, "myshco-69cb945801532dcfb57ad2b0d2471b68");
            _bvConfig.addProperty(BVClientConfig.STAGING, "true");
            _bvConfig.addProperty(BVClientConfig.BV_ROOT_FOLDER, "Main_Site-en_US");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT, "1");
            _bvConfig.addProperty(BVClientConfig.EXECUTION_TIMEOUT_BOT, "10000");

            BVParameters _bvParam = new BVParameters();
            //_bvParam.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.29.13 (KHTML, like Gecko) Version/6.0.4 Safari/536.29.13";
            _bvParam.UserAgent = "google";
            _bvParam.BaseURI = "http://localhost:8080/thispage.htm"; 
            _bvParam.PageURI = "http://localhost:8080/abcd" + "?" + "notSure=1&letSee=2";
            _bvParam.ContentType = new BVContentType(BVContentType.REVIEWS);
            _bvParam.SubjectType = new BVSubjectType(BVSubjectType.PRODUCT);
            _bvParam.SubjectId = "2000002";

            BVUIContent _bvOutput = new BVManagedUIContent(_bvConfig);

            String sBvOutputSummary = _bvOutput.getAggregateRating(_bvParam);

            Assert.AreEqual<Boolean>(sBvOutputSummary.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                true, "there should be AggregateRating in the content");
            Assert.AreEqual<Boolean>(!sBvOutputSummary.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true, 
				"there should not be reviews section in the content");

		    String sBvOutputReviews = _bvOutput.getReviews(_bvParam);
            Assert.AreEqual<Boolean>(sBvOutputReviews.Contains("itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\""), true, 
				    "there should be reviews section in the content");
            Assert.AreEqual<Boolean>(!sBvOutputReviews.Contains("itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\""),
                    true, "there should not be AggregateRating in the content");
        }