public void MSASAIRS_S02_TC13_NativeBodyTypeAndType_HTML()
{
#region Send an html email
string subject = Common.GenerateResourceName(Site, "Subject");
string body = Common.GenerateResourceName(Site, "Body");
this.SendEmail(EmailType.HTML, subject, body);
#endregion
#region Set BodyPreference element
Request.BodyPreference[] bodyPreference = new Request.BodyPreference[]
{
new Request.BodyPreference()
{
Type = 2
}
};
Request.BodyPreference[] bodyPreferenceWithType4 = new Request.BodyPreference[]
{
new Request.BodyPreference()
{
Type = 4
}
};
#endregion
#region Verify Sync command
DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
this.VerifyType(syncItem.Email, bodyPreference[0].Type);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R238");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R238
Site.CaptureRequirementIfAreEqual<byte?>(
2,
syncItem.Email.NativeBodyType,
238,
@"[In NativeBodyType] [The value] 2 represents HTML.");
// According to above steps, requirement MS-ASAIRS_R2411 can be captured directly
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R2411");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R2411
Site.CaptureRequirement(
2411,
@"[In NativeBodyType] The NativeBodyType and Type elements have the same value if the server has not modified the format of the body to match the client's request.");
#endregion
#region Verify ItemOperations command
DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference, null, DeliveryMethodForFetch.Inline);
this.VerifyType(itemOperationsItem.Email, bodyPreference[0].Type);
#endregion
#region Verify Search command
DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
this.VerifyType(searchItem.Email, bodyPreference[0].Type);
#endregion
#region Verify requirements
// According to above steps, requirement MS-ASAIRS_R305 can be captured directly
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R305");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R305
Site.CaptureRequirement(
305,
@"[In Type] [The value] 2 [of Type element] means HTML.");
#endregion
#region Verify Sync command when setting Type to 4
DataStructures.Sync syncItemWithType4 = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreferenceWithType4, null);
Site.Assert.IsNotNull(
syncItemWithType4.Email.Body,
"The Body element should be included in Sync command response when the BodyPreference element is specified in Sync command request.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R307");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R307
Site.CaptureRequirementIfAreEqual<byte>(
4,
syncItemWithType4.Email.Body.Type,
307,
@"[In Type] [The value] 4 [of Type element] means MIME.");
Site.Assert.AreEqual<byte?>(
2,
syncItemWithType4.Email.NativeBodyType,
"The NativeBodyType value should be 2.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R2412");
// Verify MS-ASAIRS requirement: MS-ASAIRS_R2412
Site.CaptureRequirementIfAreNotEqual<byte?>(
syncItemWithType4.Email.Body.Type,
syncItemWithType4.Email.NativeBodyType,
2412,
@"[In NativeBodyType] The NativeBodyType and Type elements have different values if the server has modified the format of the body to match the client's request.");
#endregion
}
#endregion