Microsoft.Protocols.TestSuites.MS_ASEMAIL.S01_Email.MSASEMAIL_S01_TC23_InvalidSearch C# (CSharp) Method

MSASEMAIL_S01_TC23_InvalidSearch() private method

private MSASEMAIL_S01_TC23_InvalidSearch ( ) : void
return void
        public void MSASEMAIL_S01_TC23_InvalidSearch()
        {
            #region Call method SendMail to send an email.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty);
            #endregion

            #region Call Search command including "To" element to Search email from server.
            // Ensure the email item has reached the recipient's inbox folder.
            this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Search email from server
            SearchRequest searchRequest = TestSuiteHelper.CreateSearchRequest(emailSubject, this.User2Information.InboxCollectionId);
            SendStringResponse result = this.EMAILAdapter.InvalidSearch(searchRequest, string.Format("<To xmlns=\"Email\">{0}</To>", Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain)));

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result.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);
                result = this.EMAILAdapter.InvalidSearch(searchRequest, string.Format("<To xmlns=\"Email\">{0}</To>", Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain)));
                doc.LoadXml(result.ResponseDataXML);
                xnm = new XmlNamespaceManager(doc.NameTable);
                xnm.AddNamespace("e", "Search");
                searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm);
                counter++;
            }

            XmlNode status = doc.SelectSingleNode("/e:Search/e:Response/e:Store/e:Status", xnm);

            Site.Assert.IsNotNull(status, "The status of Search command response shouldn't be null");
            #endregion

            #region Verify requirement
            // If the Search command response from the server contains a search:Status element value of 2 as a child element of the search:Store element, then R68 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R68");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R68
            Site.CaptureRequirementIfAreEqual<string>(
                "2",
                status.InnerText,
                68,
                @"[In Search Command Response] If E-mail class elements are included in the Search command request, the Search command response from the server contains a search:Status element ([MS-ASCMD] section 2.2.3.167.12) value of 2 as a child element of the search:Store element ([MS-ASCMD] section 2.2.3.168.2).");
            #endregion
        }
        #endregion