public void MSASAIRS_S04_TC04_IncorrectOrder()
{
#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 BodyPreference element order
DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
if (Common.IsRequirementEnabled(10031, 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']");
// Put the first node to the end.
XmlNode temp = bodyPreferenceNode.ChildNodes[0];
bodyPreferenceNode.RemoveChild(temp);
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_R10031");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10031
Site.CaptureRequirementIfAreEqual(
"2",
status,
10031,
@"[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 order] 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 BodyPreference element order
if (Common.IsRequirementEnabled(10035, 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']");
// Put the first node to the end.
XmlNode temp = bodyPreferenceNode.ChildNodes[0];
bodyPreferenceNode.RemoveChild(temp);
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_R10035");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10035
Site.CaptureRequirementIfAreEqual(
"2",
status,
10035,
@"[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 order] 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 body element order
if (Common.IsRequirementEnabled(10038, 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']");
// Put the first node to the end.
XmlNode temp = bodyNode.ChildNodes[0];
bodyNode.RemoveChild(temp);
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_R10038");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10038
Site.CaptureRequirementIfAreEqual(
"6",
status,
10038,
@"[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 order] 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
}
#endregion