public void MSOXWSCONT_S01_TC03_VerifyContactItemWithEmailAddressKeyTypeEnums()
{
// The value count of enumeration "EmailAddressKeyType" is 3.
int enumCount = 3;
EmailAddressKeyType[] emailAddressKeyTypes = new EmailAddressKeyType[enumCount];
emailAddressKeyTypes[0] = EmailAddressKeyType.EmailAddress1;
emailAddressKeyTypes[1] = EmailAddressKeyType.EmailAddress2;
emailAddressKeyTypes[2] = EmailAddressKeyType.EmailAddress3;
// Define a contact array to store the contact items got from GetItem operation response.
// Each contact should contain an EmailAddressKeyType value as its element's value.
ContactItemType[] contacts = new ContactItemType[enumCount];
for (int i = 0; i < enumCount; i++)
{
EmailAddressKeyType emailAddressKeyType = emailAddressKeyTypes[i];
#region Step 1:Create the contact item with EmailAddressKeyType
// Create a contact item with EmailAddressKeyType
ContactItemType item = this.BuildContactItemWithEmailAddress(emailAddressKeyType);
CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);
// Check the response.
Common.CheckOperationSuccess(createItemResponse, 1, this.Site);
#endregion
#region Step 2:Get the contact item.
// The contact item to get.
ItemIdType[] itemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
GetItemResponseType getItemResponse = this.CallGetItemOperation(itemIds);
// Check the response.
Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
ContactItemType[] getItems = Common.GetItemsFromInfoResponse<ContactItemType>(getItemResponse);
Site.Assert.AreEqual<int>(
1,
getItems.GetLength(0),
"One contact item should be returned!");
contacts[i] = getItems[0];
Site.Assert.IsNotNull(
contacts[i],
"The returned contact item should not be null.");
Site.Assert.IsNotNull(
contacts[i].EmailAddresses,
"The EmailAddresses element in returned contact item should not be null.");
Site.Assert.AreEqual<int>(
1,
contacts[i].EmailAddresses.GetLength(0),
"One entry of EmailAddresses element should be returned!");
#endregion
}
#region Capture Code
this.Site.Assert.IsTrue(
this.IsSchemaValidated,
"The schema should be validated! Expected result: {0}, Actual result: {1}",
true.ToString(),
this.IsSchemaValidated.ToString());
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R124");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R124
Site.CaptureRequirementIfAreEqual<EmailAddressKeyType>(
EmailAddressKeyType.EmailAddress1,
contacts[0].EmailAddresses[0].Key,
124,
@"[In t:EmailAddressKeyType Simple Type] EmailAddress1: Identifies the first e-mail address for the contact (2).");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R125");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R125
Site.CaptureRequirementIfAreEqual<EmailAddressKeyType>(
EmailAddressKeyType.EmailAddress2,
contacts[1].EmailAddresses[0].Key,
125,
@"[In t:EmailAddressKeyType Simple Type] EmailAddress2: Identifies the second e-mail address for the contact (2).");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R126");
// Verify MS-OXWSCONT requirement: MS-OXWSCONT_R126
Site.CaptureRequirementIfAreEqual<EmailAddressKeyType>(
EmailAddressKeyType.EmailAddress3,
contacts[2].EmailAddresses[0].Key,
126,
@"[In t:EmailAddressKeyType Simple Type] EmailAddress3: Identifies the third e-mail address for the contact (2).");
#endregion
}