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

            #region Step 1. The client creates a message in the root public folder.
            ulong messageId = 0;
            uint messageHandle = 0;
            this.CreateSaveMessage(this.publicRootFolderHandle, this.publicRootFolderId, ref messageId, ref messageHandle);
            #endregion

            #region Step 2. The client calls RopGetContentsTable to retrieve the contents table of the root public folder.
            RopGetContentsTableRequest getContentsTableRequestFirst = new RopGetContentsTableRequest
            {
                RopId = (byte)RopId.RopGetContentsTable,
                LogonId = Constants.CommonLogonId,
                InputHandleIndex = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                TableFlags = 0x00
            };

            // Get the Contents table of the opened folder.
            RopGetContentsTableResponse getContentsTableResponseFirst = this.Adapter.GetContentsTable(getContentsTableRequestFirst, this.publicRootFolderHandle, ref this.responseHandles);

            uint rowCountFirst = getContentsTableResponseFirst.RowCount;
            #endregion

            #region Step 3. The client calls RopHardDeleteMessage to delete this message in the root public folder.
            object ropResponse = null;
            ulong[] messageIds = new ulong[] { messageId };

            RopHardDeleteMessagesRequest hardDeleteMessagesRequest = new RopHardDeleteMessagesRequest();
            RopHardDeleteMessagesResponse hardDeleteMessagesResponse = new RopHardDeleteMessagesResponse();
            hardDeleteMessagesRequest.RopId = (byte)RopId.RopHardDeleteMessages;
            hardDeleteMessagesRequest.LogonId = Constants.CommonLogonId;
            hardDeleteMessagesRequest.InputHandleIndex = Constants.CommonInputHandleIndex;
            hardDeleteMessagesRequest.WantAsynchronous = 0x00;

            // The server does not generate a non-read receipt for the deleted messages.
            hardDeleteMessagesRequest.NotifyNonRead = 0x00;
            hardDeleteMessagesRequest.MessageIdCount = (ushort)messageIds.Length;
            hardDeleteMessagesRequest.MessageIds = messageIds;
            this.Adapter.DoRopCall(hardDeleteMessagesRequest, this.publicRootFolderHandle, ref ropResponse, ref this.responseHandles);
            hardDeleteMessagesResponse = (RopHardDeleteMessagesResponse)ropResponse;

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

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R99401
            Site.CaptureRequirementIfAreEqual<uint>(
                Constants.SuccessCode,
                hardDeleteMessagesResponse.ReturnValue,
                99401,
                @"[In RopHardDeleteMessages ROP] This ROP [RopHardDeleteMessages] applies to both public folders [and private mailboxes].");
            #endregion

            #region Step 4. The client calls RopGetContentsTable to retrieve the contents table of the root public folder.
            RopGetContentsTableRequest getContentsTableRequestSecond = new RopGetContentsTableRequest
            {
                RopId = (byte)RopId.RopGetContentsTable,
                LogonId = Constants.CommonLogonId,
                InputHandleIndex = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                TableFlags = (byte)FolderTableFlags.Depth
            };

            // Get the Contents table of the opened folder.
            RopGetContentsTableResponse getContentsTableResponseSecond = this.Adapter.GetContentsTable(getContentsTableRequestSecond, this.publicRootFolderHandle, ref this.responseHandles);

            uint rowCountSecond = getContentsTableResponseSecond.RowCount;

            Assert.AreEqual<uint>(rowCountFirst - 1, rowCountSecond, "If ROP succeeds, the second RowCount value returned from server should be one less than the first one. ");
            #endregion
        }
Пример #2
0
        /// <summary>
        /// Verify the response of RopHardDeleteMessages ROP operation.
        /// </summary>
        /// <param name="hardDeleteMessages">The response of RopHardDeleteMessages operation</param>
        private void VerifyRopHardDeleteMessages(RopHardDeleteMessagesResponse hardDeleteMessages)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R302");

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R302
            Site.CaptureRequirementIfAreEqual<uint>(
                Constants.SuccessCode,
                hardDeleteMessages.ReturnValue,
                302,
                @"[In RopHardDeleteMessages ROP Response Buffer] ReturnValue (4 bytes): The server returns 0x00000000 to indicate success.");

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

            // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R283
            Site.CaptureRequirementIfAreEqual<uint>(
                Constants.SuccessCode,
                hardDeleteMessages.ReturnValue,
                283,
                @"[In RopHardDeleteMessages ROP] The RopHardDeleteMessages ROP ([MS-OXCROPS] section 2.2.4.12) is used to hard delete one or more messages from a folder.");
        }
        /// <summary>
        /// Verify RopHardDeleteMessages Response
        /// </summary>
        /// <param name="ropHardDeleteMessagesResponse">The response of RopHardDeleteMessages request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopHardDeleteMessages request</param>
        private void VerifyRopHardDeleteMessagesResponse(RopHardDeleteMessagesResponse ropHardDeleteMessagesResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R971");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R971
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropHardDeleteMessagesResponse.RopId.GetType(),
                971,
                @"[In RopHardDeleteMessages ROP Response Buffer] RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R973
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopHardDeleteMessages,
                ropHardDeleteMessagesResponse.RopId,
                973,
                @"[In RopHardDeleteMessages ROP Response Buffer] RopId (1 byte): For this operation[RopHardDeleteMessages], this field[RopId (1 byte)] is set to 0x91.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R974
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropHardDeleteMessagesResponse.InputHandleIndex.GetType(),
                974,
                @"[In RopHardDeleteMessages ROP Response Buffer] InputHandleIndex (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R975
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropHardDeleteMessagesResponse.InputHandleIndex,
                975,
                @"[In RopHardDeleteMessages ROP Response Buffer] InputHandleIndex (1 byte): This index that MUST be set to the value specified in the InputHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R976
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropHardDeleteMessagesResponse.ReturnValue.GetType(),
                976,
                @"[In RopHardDeleteMessages ROP Response Buffer] ReturnValue (4 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R978,PartialCompletion:{0}", ropHardDeleteMessagesResponse.PartialCompletion);

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R978
            // If PartialCompletion is byte type and can be boolean type representation, then verify R978
            bool isVerifyR978 = (typeof(byte) == ropHardDeleteMessagesResponse.PartialCompletion.GetType()) &&
                                ((Convert.ToBoolean(ropHardDeleteMessagesResponse.PartialCompletion) == true) ||
                                (Convert.ToBoolean(ropHardDeleteMessagesResponse.PartialCompletion) == false));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR978,
                978,
                @"[In RopHardDeleteMessages ROP Response Buffer] PartialCompletion (1 byte): A Boolean.");
        }