private PhysicalAddressType Convert(PhysicalAddressIndexType indexType)
        {
            switch (indexType)
            {
            case PhysicalAddressIndexType.None:
                return(PhysicalAddressType.None);

            case PhysicalAddressIndexType.Home:
                return(PhysicalAddressType.Home);

            case PhysicalAddressIndexType.Business:
                return(PhysicalAddressType.Business);

            case PhysicalAddressIndexType.Other:
                return(PhysicalAddressType.Other);

            default:
                throw new InvalidContactException();
            }
        }
        public void MSOXWSCONT_S01_TC07_VerifyContactItemWithPhysicalAddressIndexTypeEnums()
        {
            // The value count of enumeration "PhysicalAddressIndexType" is 4.
            int enumCount = 4;
            PhysicalAddressIndexType[] physicalAddressIndexTypes = new PhysicalAddressIndexType[enumCount];

            physicalAddressIndexTypes[0] = PhysicalAddressIndexType.None;
            physicalAddressIndexTypes[1] = PhysicalAddressIndexType.Business;
            physicalAddressIndexTypes[2] = PhysicalAddressIndexType.Home;
            physicalAddressIndexTypes[3] = PhysicalAddressIndexType.Other;

            // Define a contact array to store the contact items got from GetItem operation response.
            // Each contact should contain a PhysicalAddressIndexType value as its element's value.
            ContactItemType[] contacts = new ContactItemType[enumCount];
            for (int i = 0; i < enumCount; i++)
            {
                PhysicalAddressIndexType physicalAddressIndexType = physicalAddressIndexTypes[i];

                #region Step 1:Create the contact item with PhysicalAddressIndexType
                // Create a contact item with PhysicalAddressIndexType.
                ContactItemType item = new ContactItemType()
                {
                    PostalAddressIndex = physicalAddressIndexType,
                    PostalAddressIndexSpecified = true,
                };
                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.IsTrue(
                    contacts[i].PostalAddressIndexSpecified,
                    "The PostalAddressIndex element in returned contact item should be present.");
                #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_R180");

            // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R180
            Site.CaptureRequirementIfAreEqual<PhysicalAddressIndexType>(
                PhysicalAddressIndexType.None,
                contacts[0].PostalAddressIndex,
                180,
                @"[In t:PhysicalAddressIndexType Simple Type] None: Indicates that no type is specified for the address.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R181");

            // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R181
            Site.CaptureRequirementIfAreEqual<PhysicalAddressIndexType>(
                PhysicalAddressIndexType.Business,
                contacts[1].PostalAddressIndex,
                181,
                @"[In t:PhysicalAddressIndexType Simple Type] Business: Displays the address as a business address.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R182");

            // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R182
            Site.CaptureRequirementIfAreEqual<PhysicalAddressIndexType>(
                PhysicalAddressIndexType.Home,
                contacts[2].PostalAddressIndex,
                182,
                @"[In t:PhysicalAddressIndexType Simple Type] Home: Displays the address as a home address.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R183");

            // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R183
            Site.CaptureRequirementIfAreEqual<PhysicalAddressIndexType>(
                PhysicalAddressIndexType.Other,
                contacts[3].PostalAddressIndex,
                183,
                @"[In t:PhysicalAddressIndexType Simple Type] Other: Displays the address as an address of type other.");
            #endregion
        }