public void MSASAIRS_S04_TC03_IncorrectNumberOfInstances()
{
#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 multiple AllOrNone elements
DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
if (Common.IsRequirementEnabled(10030, this.Site))
{
ItemOperationsRequest itemOperationRequest = TestSuiteHelper.CreateItemOperationsRequest(this.User2Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference, null);
// Add another AllOrNone element in BodyPreference element
XmlDocument doc = new XmlDocument();
doc.LoadXml(itemOperationRequest.GetRequestDataSerializedXML());
XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']");
XmlNode allOrNoneNode = doc.SelectSingleNode("//*[name()='AllOrNone']");
XmlNode temp = allOrNoneNode.Clone();
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_R10030");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10030
Site.CaptureRequirementIfAreEqual(
"2",
status,
10030,
@"[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 number of instances] 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 multiple AllOrNone elements
if (Common.IsRequirementEnabled(10034, this.Site))
{
SearchRequest searchRequest = TestSuiteHelper.CreateSearchRequest(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
// Add another AllOrNone element in BodyPreference element
XmlDocument doc = new XmlDocument();
doc.LoadXml(searchRequest.GetRequestDataSerializedXML());
XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']");
XmlNode allOrNoneNode = doc.SelectSingleNode("//*[name()='AllOrNone']");
XmlNode temp = allOrNoneNode.Clone();
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_R10034");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10034
Site.CaptureRequirementIfAreEqual(
"2",
status,
10034,
@"[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 number of instances] 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 multiple Type elements in Body
if (Common.IsRequirementEnabled(10037, this.Site))
{
SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncRequest(this.GetInitialSyncKey(this.User2Information.InboxCollectionId), this.User2Information.InboxCollectionId, CreateSyncAddCommands(), null, null);
// Add another Type element in Body element
XmlDocument doc = new XmlDocument();
doc.LoadXml(syncAddRequest.GetRequestDataSerializedXML());
XmlNode bodyNode = doc.SelectSingleNode("//*[name()='Body']");
XmlNode typeNode = bodyNode.SelectSingleNode("//*[name()='Type']");
XmlNode temp = typeNode.Clone();
bodyNode.InsertBefore(temp, typeNode);
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_R10037");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R10037
Site.CaptureRequirementIfAreEqual(
"6",
status,
10037,
@"[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 number of instances] 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