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

MSASCMD_S14_TC04_Search_TooComplex_Status8_CollectionId() private method

        public void MSASCMD_S14_TC04_Search_TooComplex_Status8_CollectionId()
        {
            #region Create a search request in which a CollectionId element is not in And element.
            string collectionIdElement = "<CollectionId xmlns=\"AirSync\">" + this.User1Information.InboxCollectionId + "</CollectionId>";

            // Insert CollectionId element before And element.
            string invalidSearchRequest = this.CreateInvalidSearchRequest(collectionIdElement, "<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_R2032");

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