Microsoft.Protocols.TestSuites.MS_ASCMD.S14_Search.MSASCMD_S14_TC31_Search_TooComplex_Status8_GreaterThan C# (CSharp) Method

MSASCMD_S14_TC31_Search_TooComplex_Status8_GreaterThan() private method

        public void MSASCMD_S14_TC31_Search_TooComplex_Status8_GreaterThan()
        {
            #region Create a search request in which a GreaterThan element is not in And element.
            string greaterThanElement = "<GreaterThan><DateReceived  xmlns=\"Email\"/><Value>2012-03-28T07:31:09.314Z</Value></GreaterThan>";

            // Insert GreaterThan element before And element
            string invalidSearchRequest = this.CreateInvalidSearchRequest(greaterThanElement, "<And>");
            #endregion

            #region Call method SendStringRequest to send a plain text request.
            SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, invalidSearchRequest);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(response.ResponseDataXML);
            XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
            xnm.AddNamespace("e", "Search");

            int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
            int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int counter = 1;
            XmlNode searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm);

            while (counter < retryCount && searchStatus != null && searchStatus.InnerXml.Equals("10"))
            {
                Thread.Sleep(waitTime);
                response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, invalidSearchRequest);
                doc.LoadXml(response.ResponseDataXML);
                xnm = new XmlNamespaceManager(doc.NameTable);
                xnm.AddNamespace("e", "Search");
                searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm);
                counter++;
            }

            string status = Common.GetSearchStatusCode(response);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3143");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3143
            Site.CaptureRequirementIfAreEqual<string>(
                "8",
                status,
                3143,
                @"[In GreaterThan] If the GreaterThan element is included as a child element of any element other than the And element (section 2.2.3.10), the server responds with a Status element (section 2.2.3.162.12) value of 8 (SearchTooComplex).");
            #endregion
        }
S14_Search