public void MSASCMD_S14_TC02_Search_MultipleAndElements()
{
#region Create a search request with multiple And elements.
Request.SearchStore store = new Request.SearchStore
{
Name = SearchName.Mailbox.ToString(),
Options = new Request.Options1
{
Items = new object[] { string.Empty },
ItemsElementName = new Request.ItemsChoiceType6[] { Request.ItemsChoiceType6.DeepTraversal }
},
Query = new Request.queryType
{
ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And, Request.ItemsChoiceType2.And },
Items = new Request.queryType[] { new Request.queryType(), new Request.queryType() }
}
};
// Create search request with multiple And elements.
((Request.queryType)store.Query.Items[0]).ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.Class, Request.ItemsChoiceType2.CollectionId, Request.ItemsChoiceType2.FreeText };
((Request.queryType)store.Query.Items[0]).Items = new object[] { "Email", this.User1Information.InboxCollectionId, "FreeText" };
SearchRequest invalidSearchRequest = Common.CreateSearchRequest(new Request.SearchStore[] { store });
#endregion
#region Call method SendStringRequest to send a plain text request.
string sendStringRequest = invalidSearchRequest.GetRequestDataSerializedXML();
SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Search, null, sendStringRequest);
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, sendStringRequest);
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_R772");
// Verify MS-ASCMD requirement: MS-ASCMD_R772
Site.CaptureRequirementIfAreEqual<string>(
"8",
status,
772,
@"[In And] If multiple And elements are included in the request, the server responds with a Status element (section 2.2.3.162.12) value of 8 (SearchTooComplex).");
#endregion
}