static private CreateSearchRequest ( string query, string collectionId, string conversationId, |
||
query | string | The query string. |
collectionId | string | The collection id of searched folder. |
conversationId | string | The conversation for which to search. |
bodyPreferences | The bodyPreference in the options element. | |
bodyPartPreferences | The bodyPartPreference in the options element. | |
return | SearchRequest |
/// <summary> /// Search item with specified criteria on the server. /// </summary> /// <param name="subject">The subject of the item.</param> /// <param name="collectionId">The collection id.</param> /// <param name="conversationId">The conversation for which to search.</param> /// <param name="bodyPreferences">The bodyPreference in the options element.</param> /// <param name="bodyPartPreferences">The bodyPartPreference in the options element.</param> /// <returns>The server response.</returns> protected DataStructures.Search GetSearchResult(string subject, string collectionId, string conversationId, Request.BodyPreference[] bodyPreferences, Request.BodyPartPreference[] bodyPartPreferences) { SearchRequest request = TestSuiteHelper.CreateSearchRequest(subject, collectionId, conversationId, bodyPreferences, bodyPartPreferences); DataStructures.SearchStore searchStore = this.ASAIRSAdapter.Search(request); DataStructures.Search searchItem = null; if (searchStore.Results.Count != 0) { searchItem = TestSuiteHelper.GetSearchItem(searchStore, subject); } this.Site.Assert.IsNotNull(searchItem, "The email message with subject {0} should be found.", subject); return(searchItem); }
public void MSASAIRS_S04_TC05_IncorrectPlacement() { #region Send a plain text email string subject = Common.GenerateResourceName(Site, "Subject"); string body = Common.GenerateResourceName(Site, "Body"); this.SendEmail(EmailType.Plaintext, subject, body); #endregion #region Set BodyPreference element Request.BodyPreference[] bodyPreference = new Request.BodyPreference[] { new Request.BodyPreference() { Type = 1, TruncationSize = 100, TruncationSizeSpecified = true, AllOrNone = true, AllOrNoneSpecified = true } }; #endregion #region Call ItemOperations command with incorrect placement of BodyPreference element. DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null); if (Common.IsRequirementEnabled(10032, this.Site)) { ItemOperationsRequest itemOperationRequest = TestSuiteHelper.CreateItemOperationsRequest(this.User2Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference, null); XmlDocument doc = new XmlDocument(); doc.LoadXml(itemOperationRequest.GetRequestDataSerializedXML()); XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']"); // Add another BodyPreference element in the BodyPreference element, the placement is invalid. XmlNode temp = bodyPreferenceNode.Clone(); temp.SelectSingleNode("//*[name()='Type']").InnerText = "2"; bodyPreferenceNode.AppendChild(temp); SendStringResponse itemOperationResponse = this.ASAIRSAdapter.ItemOperations(doc.OuterXml); string status = this.GetStatusCodeFromXPath(itemOperationResponse, "/i:ItemOperations/i:Status"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R10032"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R10032 Site.CaptureRequirementIfAreEqual( "2", status, 10032, @"[In Appendix B: Product Behavior] Implementation does return protocol status error 2 for an ItemOperations command (as specified in [MS-ASCMD] section 2.2.2.8), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)"); } #endregion #region Call Search command with incorrect placement of BodyPreference element. if (Common.IsRequirementEnabled(10036, this.Site)) { SearchRequest searchRequest = TestSuiteHelper.CreateSearchRequest(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null); XmlDocument doc = new XmlDocument(); doc.LoadXml(searchRequest.GetRequestDataSerializedXML()); XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']"); // Add another BodyPreference element in the BodyPreference element, the placement is invalid. XmlNode temp = bodyPreferenceNode.Clone(); temp.SelectSingleNode("//*[name()='Type']").InnerText = "2"; bodyPreferenceNode.AppendChild(temp); SendStringResponse searchResponse = this.ASAIRSAdapter.Search(doc.OuterXml); string searchStatus = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Status"); int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int counter = 1; while (counter < retryCount && searchStatus.Equals("10")) { Thread.Sleep(waitTime); searchResponse = this.ASAIRSAdapter.Search(doc.OuterXml); searchStatus = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Status"); counter++; } string status = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Response/s:Store/s:Status"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R10036"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R10036 Site.CaptureRequirementIfAreEqual( "2", status, 10036, @"[In Appendix B: Product Behavior] Implementation does return protocol status error 2 for a Search command (as specified in [MS-ASCMD] section 2.2.2.14), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)"); } #endregion #region Call Sync add command with incorrect placement of Type element. if (Common.IsRequirementEnabled(10039, this.Site)) { SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncRequest(this.GetInitialSyncKey(this.User2Information.InboxCollectionId), this.User2Information.InboxCollectionId, CreateSyncAddCommands(), null, null); XmlDocument doc = new XmlDocument(); doc.LoadXml(syncAddRequest.GetRequestDataSerializedXML()); XmlNode bodyNode = doc.SelectSingleNode("//*[name()='Body']"); // Add another body element in the body element, the placement is invalid. XmlNode temp = bodyNode.Clone(); temp.SelectSingleNode("//*[name()='Type']").InnerText = "2"; bodyNode.AppendChild(temp); SendStringResponse syncAddResponse = this.ASAIRSAdapter.Sync(doc.OuterXml); string status = this.GetStatusCodeFromXPath(syncAddResponse, "/a:Sync/a:Collections/a:Collection/a:Responses/a:Add/a:Status"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R10039"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R10039 Site.CaptureRequirementIfAreEqual( "6", status, 10039, @"[In Appendix B: Product Behavior] Implementation does return protocol status error 6 for a Sync command (as specified in [MS-ASCMD] section 2.2.2.19), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)"); } #endregion }