Microsoft.Protocols.TestSuites.MS_OXWSCONT.S01_CreateGetDeleteContactItem.MSOXWSCONT_S01_TC09_VerifyErrorCannotCreateContactInNonContactFolder C# (CSharp) Method

MSOXWSCONT_S01_TC09_VerifyErrorCannotCreateContactInNonContactFolder() private method

        public void MSOXWSCONT_S01_TC09_VerifyErrorCannotCreateContactInNonContactFolder()
        {
            #region Step 1:Create the contact item.
            CreateItemType createItemRequest = new CreateItemType();

            #region Config the contact item
            createItemRequest.Items = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ContactItemType[1];

            // Create a contact item without optional elements.
            createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties();

            // Configure create item to draft folder to trigger the error.
            DistinguishedFolderIdType errorDistinguishedFolderId = new DistinguishedFolderIdType();
            errorDistinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts;
            createItemRequest.SavedItemFolderId = new TargetFolderIdType();
            createItemRequest.SavedItemFolderId.Item = errorDistinguishedFolderId;
            #endregion

            CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest);

            Site.Assert.AreEqual<int>(
                 1,
                 createItemResponse.ResponseMessages.Items.GetLength(0),
                 "Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 createItemResponse.ResponseMessages.Items.GetLength(0));
            #endregion

            #region Capture Code
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R262");

            // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R262
            Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorCannotCreateContactInNonContactFolder,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "MS-OXWSCDATA",
                262,
                @"[In m:ResponseCodeType Simple Type]The value ""ErrorCannotCreateContactInNonContactFolder"" specifies that an attempt was made to create a contact in a folder other than the Contacts folder.");
            #endregion
        }