public void MSOXCFOLD_S04_TC05_RopMovePublicFolder()
        {
            this.CheckWhetherSupportTransport();
            this.Logon();
            this.PublicFolderInitialization();

            #region Step 1. The client calls RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root public folder.

            RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest
            {
                RopId = (byte)RopId.RopCreateFolder,
                LogonId = Constants.CommonLogonId,
                InputHandleIndex = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                FolderType = (byte)FolderType.Genericfolder,
                UseUnicodeStrings = 0x0,
                OpenExisting = 0x01,
                Reserved = 0x0,
                DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1),
                Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1)
            };

            RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.publicRootFolderHandle, ref this.responseHandles);
            Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs should successfully.");
            uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex];

            #endregion

            #region Step 2. The client calls RopCreateFolder to create [MSOXCFOLDSubfolder2] under the root public folder.

            createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder2);
            createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.Subfolder2);

            createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.publicRootFolderHandle, ref this.responseHandles);
            Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs should successfully.");
            ulong subfolderId2 = createFolderResponse.FolderId;

            #endregion

            #region Step 3. The client calls RopMoveFolder to move the [MSOXCFOLDSubfolder2] from root public folder to [MSOXCFOLDSubfolder1].
            // Initialize a list of server object handles.
            List<uint> handleList = new List<uint>
            {
                // Add the source folder handle to the list of server object handles, and its index value is 0x00.
                // Add the destination folder handle to the server object handle table, and its index value is 0x01.
                this.publicRootFolderHandle, subfolderHandle1
            };

            RopMoveFolderRequest moveFolderRequest = new RopMoveFolderRequest
            {
                RopId = (byte)RopId.RopMoveFolder,
                LogonId = Constants.CommonLogonId,
                SourceHandleIndex = 0x00,
                DestHandleIndex = 0x01,
                WantAsynchronous = 0x00,
                UseUnicode = 0x01,
                FolderId = subfolderId2,
                NewFolderName = Encoding.Unicode.GetBytes(Constants.Subfolder3)
            };

            RopMoveFolderResponse moveFolderResponse = this.Adapter.MoveFolder(moveFolderRequest, handleList, ref this.responseHandles);
            Site.Assert.AreEqual<uint>(Constants.SuccessCode, moveFolderResponse.ReturnValue, "The RopMoveFolder operation performs should successfully.");
            handleList.Clear();

            #endregion

            #region Step 4. The client calls RopGetHierarchyTable to retrieve the hierarchy table of the root public folder.

            RopGetHierarchyTableRequest getHierarchyTableRequest = new RopGetHierarchyTableRequest
            {
                RopId = (byte)RopId.RopGetHierarchyTable,
                LogonId = Constants.CommonLogonId,
                InputHandleIndex = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                TableFlags = (byte)FolderTableFlags.Depth
            };

            RopGetHierarchyTableResponse getHierarchyTableResponse = this.Adapter.GetHierarchyTable(getHierarchyTableRequest, this.publicRootFolderHandle, ref this.responseHandles);
            Site.Assert.AreEqual<uint>(Constants.SuccessCode, getHierarchyTableResponse.ReturnValue, "RopGetHierarchyTable ROP operation performs should successfully.");
            RopGetHierarchyTableResponse getHierarchyTableResponse1 = getHierarchyTableResponse;

            #endregion

            #region Step 5. The client calls RopGetHierarchyTable to retrieve the hierarchy table of the [MSOXCFOLDSubfolder1].

            getHierarchyTableResponse = this.Adapter.GetHierarchyTable(getHierarchyTableRequest, subfolderHandle1, ref this.responseHandles);
            Site.Assert.AreEqual<uint>(Constants.SuccessCode, getHierarchyTableResponse.ReturnValue, "RopGetHierarchyTable ROP operation performs should successfully.");

            // Add the debug information
            Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXCFOLD_R17102: The subfolder count of target folder before RopMoveFolder was {0}, The subfolder count of source folder after RopMoveFolder was {1}.",
                getHierarchyTableResponse1.RowCount,
                getHierarchyTableResponse.RowCount);

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R17102
            bool isVerifyR17102 = getHierarchyTableResponse1.RowCount == 2 && getHierarchyTableResponse.RowCount == 1;

            Site.CaptureRequirementIfIsTrue(
                isVerifyR17102,
                17102,
                @"[In RopMoveFolder ROP] The move can be within [a private mailbox] or a public folder, [or between a private mailbox and a public folder].");
            #endregion
        }
        public void MSOXCFOLD_S05_TC04_RopMoveFolderPartialCompleteValidation()
        {
            if (!Common.IsRequirementEnabled(1114, this.Site))
            {
                this.NeedCleanup = false;
                Site.Assert.Inconclusive("The implementation does not support to set nonzero value to PartialCompletion field of the RopMoveFolder ROP response if the server fails to move any folder, message, or subfolder by RopMoveFolder ROP.");
            }

            this.CheckWhetherSupportTransport();
            this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer);
            uint pidTagMemberRights = 0;
            uint logonHandle = 0;
            this.GenericFolderInitialization();

            #region Step 1. Assign access permission for common user on the inbox and the root folder.
            uint inboxHandle = 0;
            this.OpenFolder(this.LogonHandle, this.DefaultFolderIds[this.inboxIndex], ref inboxHandle);

            // Add folder visible permission for the inbox.
            pidTagMemberRights = (uint)PidTagMemberRightsEnum.FolderVisible | (uint)PidTagMemberRightsEnum.ReadAny;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, inboxHandle);

            // Add folder visible permission for the root folder.
            pidTagMemberRights = (uint)PidTagMemberRightsEnum.FolderVisible | (uint)PidTagMemberRightsEnum.EditOwned;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, this.RootFolderHandle);
            #endregion

            #region Step 2. Create a subfolder [MSOXCFOLDSubfolder1] in the root folder and assign FolderVisible permission for common user on the new folder.
            uint adminSubfolderHandle1 = 0;
            ulong adminSubfolderId1 = 0;
            this.CreateFolder(this.RootFolderHandle, Constants.Subfolder1, ref adminSubfolderId1, ref adminSubfolderHandle1);

            pidTagMemberRights = (uint)PidTagMemberRightsEnum.FolderVisible | (uint)PidTagMemberRightsEnum.ReadAny;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, adminSubfolderHandle1);
            #endregion

            #region Step 3. Create a subfolder [MSOXCFOLDSubfolder2] in the root folder and assign full permission for common user on the new folder.
            uint adminSubfolderHandle2 = 0;
            ulong adminSubfolderId2 = 0;
            this.CreateFolder(this.RootFolderHandle, Constants.Subfolder2, ref adminSubfolderId2, ref adminSubfolderHandle2);

            pidTagMemberRights = (uint)PidTagMemberRightsEnum.FullPermission;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, adminSubfolderHandle2);
            #endregion

            #region Step 4. Create a subfolder [MSOXCFOLDSubfolder3] in the [MSOXCFOLDSubfolder1] and assign full permission for common user on the new folder.
            uint adminSubfolderHandle3 = 0;
            ulong adminSubfolderId3 = 0;
            this.CreateFolder(adminSubfolderHandle1, Constants.Subfolder3, ref adminSubfolderId3, ref adminSubfolderHandle3);

            pidTagMemberRights = (uint)PidTagMemberRightsEnum.FolderVisible;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, adminSubfolderHandle3);
            #endregion

            #region Step 5. Create a subfolder [MSOXCFOLDSubfolder4] in the root folder.
            uint adminSubfolderHandle4 = 0;
            ulong adminSubfolderId4 = 0;
            this.CreateFolder(adminSubfolderHandle3, Constants.Subfolder4, ref adminSubfolderId4, ref adminSubfolderHandle4);

            pidTagMemberRights = (uint)PidTagMemberRightsEnum.None;
            this.AddPermission(this.commonUserEssdn, pidTagMemberRights, adminSubfolderHandle4);
            #endregion

            #region Step 6. Logon to the private mailbox use common user.
            this.Adapter.DoDisconnect();
            this.Adapter.DoConnect(this.sutServer, ConnectionType.PrivateMailboxServer, this.commonUserEssdn, this.domain, this.commonUser, this.commonUserPassword);
            RopLogonResponse logonResponse = this.Logon(LogonFlags.Private, out logonHandle, (uint)OpenFlags.UsePerMDBReplipMapping);
            #endregion

            #region Step 7. The common user open the root folder, [MSOXCFOLDSubfolder1], [MSOXCFOLDSubfolder2] and [MSOXCFOLDSubfolder3].

            // Find and open the root folder.
            ulong commonUserRootFolderId = this.GetSubfolderIDByName(logonResponse.FolderIds[this.inboxIndex], logonHandle, this.RootFolder);
            uint commonUserRootFolderHandle = 0;
            this.OpenFolder(logonHandle, commonUserRootFolderId, ref commonUserRootFolderHandle);

            // Find and open the folder named [MSOXCFOLDSubfolder1].
            ulong commonUserSubfolderId1 = this.GetSubfolderIDByName(commonUserRootFolderId, commonUserRootFolderHandle, Constants.Subfolder1);
            uint commonUserRootSubfolderHandle1 = 0;
            this.OpenFolder(logonHandle, commonUserSubfolderId1, ref commonUserRootSubfolderHandle1);

            // Find and open the folder named [MSOXCFOLDSubfolder2].
            ulong commonUserSubfolderId2 = this.GetSubfolderIDByName(commonUserRootFolderId, commonUserRootFolderHandle, Constants.Subfolder2);
            uint commonUserRootSubfolderHandle2 = 0;
            this.OpenFolder(logonHandle, commonUserSubfolderId2, ref commonUserRootSubfolderHandle2);
            #endregion

            #region Step 8. The client calls RopMoveFolder to move target folder [MSOXCFOLDSubfolder1] from the root folder to destination folder [MSOXCFOLDSubfolder2].

            // Initialize a server object handle table.
            List<uint> handleList = new List<uint>
            {
                commonUserRootFolderHandle, commonUserRootSubfolderHandle2
            };

            // Call the RopMoveFolder operation to move the folder.
            RopMoveFolderRequest moveFolderRequest = new RopMoveFolderRequest
            {
                RopId = (byte)RopId.RopMoveFolder,
                LogonId = Constants.CommonLogonId,
                SourceHandleIndex = 0x00,
                DestHandleIndex = 0x01,
                WantAsynchronous = 0x00,
                UseUnicode = 0x00,
                FolderId = commonUserSubfolderId1,
                NewFolderName = Encoding.ASCII.GetBytes(Constants.Subfolder5)
            };
            RopMoveFolderResponse moveFolderResponse = this.Adapter.MoveFolder(moveFolderRequest, handleList, ref this.responseHandles);

            #region Verify RopMoveFolder PartialCompletion

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

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R2191.
            Site.CaptureRequirementIfAreNotEqual<byte>(
                0,
                moveFolderResponse.PartialCompletion,
                2191,
                @"[In RopMoveFolder ROP Response Buffer] PartialCompletion (1 byte): If the ROP fails for a subset of targets, the value of this field is nonzero (TRUE). ");
            
            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1114");

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1114.
            // The server fails to move any folder and MS-OXCFOLD_R2191 captured the PartialCompletion field was set to a nonzero value, MS-OXCFOLD_R1114 can be verified directly.
            Site.CaptureRequirement(
                1114,
                @"[In Processing a RopMoveFolder ROP Request] If the server fails to move any folder, message, or subfolder, it sets the PartialCompletion field of the RopMoveFolder ROP response buffer to nonzero (TRUE), as specified in section 2.2.1.7.2.");
            #endregion

            #endregion
        }
        /// <summary>
        /// Moves a folder from one parent to another.
        /// </summary>
        /// <param name="ropMoveFolderRequest">RopMoveFolderRequest object.</param>
        /// <param name="insideObjHandle">Server object handles in RopMoveFolderRequest.</param>
        /// <param name="responseSOHTable">Server objects handles in RopMoveFolderResponse.</param>
        /// <returns>RopMoveFolderResponse object.</returns>
        public RopMoveFolderResponse MoveFolder(RopMoveFolderRequest ropMoveFolderRequest, List<uint> insideObjHandle, ref List<List<uint>> responseSOHTable)
        {
            object temp = new object();
            this.ExcuteRopCall((ISerializable)ropMoveFolderRequest, insideObjHandle, ref temp, ref responseSOHTable, ref this.rawData);
            RopMoveFolderResponse ropMoveFolderResponse = (RopMoveFolderResponse)temp;

            #region Capture Code
            // The ReturnValue equal to 0x00000000 indicate ROP operation success
            if (0x00000000 == ropMoveFolderResponse.ReturnValue)
            {
                this.VerifyRopMoveFolder(ropMoveFolderResponse);
            }

            #endregion

            return ropMoveFolderResponse;
        }