Microsoft.Protocols.TestSuites.MS_OXWSFOLD.S06_UpdateFolder.MSOXWSFOLD_S06_TC01_UpdateFolder C# (CSharp) Method

MSOXWSFOLD_S06_TC01_UpdateFolder() private method

private MSOXWSFOLD_S06_TC01_UpdateFolder ( ) : void
return void
        public void MSOXWSFOLD_S06_TC01_UpdateFolder()
        {
            #region Create a new folder in the inbox folder.

            // CreateFolder request.
            CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.inbox.ToString(), new string[] { "Custom Folder" }, new string[] { "IPF.MyCustomFolderClass" }, null);

            // Create a new folder.
            CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest);
            FolderIdType folderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId;

            // Check the response.
            Common.CheckOperationSuccess(createFolderResponse, 1, this.Site);

            // Save the new created folder's folder id.
            this.NewCreatedFolderIds.Add(folderId);

            #endregion

            #region Update Folder Operation.

            // UpdateFolder request.
            UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "SetFolderField", folderId);

            // Update the specific folder's properties.
            UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site);

            string updateNameInRequest = ((SetFolderFieldType)updateFolderRequest.FolderChanges[0].Updates[0]).Item1.DisplayName;
            #endregion

            #region Get the updated folder.

            // GetFolder request.
            GetFolderType getUpdatedFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId);

            // Get the updated folder.
            GetFolderResponseType getFolderResponse = this.FOLDAdapter.GetFolder(getUpdatedFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(getFolderResponse, 1, this.Site);

            FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getFolderResponse.ResponseMessages.Items[0];
            FolderType gotFolderInfo = (FolderType)allFolders.Folders[0];

            #endregion

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R46444
            this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                46444,
                @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseClass attribute of the UpdateFolderResponseMessage element set to ""Success"".");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4644
            this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.NoError,
                updateFolderResponse.ResponseMessages.Items[0].ResponseCode,
                4644,
                @"[In UpdateFolder Operation]A successful UpdateFolder operation request returns an UpdateFolderResponse element with the ResponseCode element of the UpdateFolderResponse element set to ""NoError"".");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8902
            this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                8902,
                @"[In t:FolderChangeType Complex Type]FolderId specifies the folder identifier and change key.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R582
            this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                582,
                @"[In m:UpdateFolderType Complex Type]The UpdateFolderType complex type specifies a request message to update folders in a mailbox. ");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R534
            // Set a property on a FolderType folder successfully, indicates that Folder represents a regular folder.
            this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                updateFolderResponse.ResponseMessages.Items[0].ResponseClass,
                534,
                @"[In t:SetFolderFieldType Complex Type]Folder represents a regular folder in the server database.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9301
            this.Site.CaptureRequirementIfAreEqual<string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                9301,
                @"[In t:FolderChangeType Complex Type][Updates] Specifies a collection of changes to a folder.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R546
            this.Site.CaptureRequirementIfAreEqual<string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                546,
                @"[In t:FolderChangeType Complex Type]The FolderChangeType complex type specifies a collection of changes to be performed on a single folder.");

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

            // All folders updated successfully!
            this.Site.CaptureRequirement(
                5051,
                @"[In m:UpdateFolderType Complex Type]FolderChanges represents an array of folders to be updated.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R531
            this.Site.CaptureRequirementIfAreEqual<string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                531,
                @"[In t:NonEmptyArrayOfFolderChangesType Complex Type]FolderChange represents a collection of changes to be performed on a single folder.");

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

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5251
            this.Site.CaptureRequirementIfAreEqual<string>(
                updateNameInRequest,
                gotFolderInfo.DisplayName,
                5251,
                @"[In t:NonEmptyArrayOfFolderChangeDescriptionsType Complex Type]SetFolderField represents an UpdateFolder operation to set a property on an existing folder.");
        }