/// <summary>
        /// This ROP opens an attachment as a message. 
        /// </summary>
        /// <param name="handle">The handle to operate.</param>
        /// <param name="openEmbeddedMessageResponse">The response of this ROP.</param>
        /// <param name="needVerify">Whether need to verify the response.</param>
        /// <returns>The index of the output handle of the response.</returns>
        private uint RopOpenEmbeddedMessage(uint handle, out RopOpenEmbeddedMessageResponse openEmbeddedMessageResponse, bool needVerify)
        {
            this.rawDataValue = null;
            this.responseValue = null;
            this.responseSOHsValue = null;

            RopOpenEmbeddedMessageRequest openEmbeddedMessageRequest = new RopOpenEmbeddedMessageRequest()
            {
                RopId = (byte)RopId.RopOpenEmbeddedMessage,

                // The logonId 0x00 is associated with RopOpenEmbeddedMessage.
                LogonId = 0x00,

                // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. 
                InputHandleIndex = (byte)HandleIndex.FirstIndex,

                // This index specifies the location 0x01 in the Server Object Handle Table where the handle for the output Server Object is stored. 
                OutputHandleIndex = (byte)HandleIndex.SecondIndex,
                CodePageId = 0x0FFF,
                OpenModeFlags = 0x02
            };

            this.responseSOHsValue = this.ProcessSingleRop(openEmbeddedMessageRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            openEmbeddedMessageResponse = (RopOpenEmbeddedMessageResponse)this.responseValue;

            if (needVerify)
            {
                this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, openEmbeddedMessageResponse.ReturnValue, string.Format("RopOpenEmbeddedMessage Failed! Error: 0x{0:X8}", openEmbeddedMessageResponse.ReturnValue));
            }

            return this.responseSOHsValue[0][openEmbeddedMessageResponse.OutputHandleIndex];
        }
        /// <summary>
        /// Verify RopOpenEmbeddedMessage Success Response
        /// </summary>
        /// <param name="ropOpenEmbeddedMessageResponse">The response of RopOpenEmbeddedMessage request</param>
        /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopOpenEmbeddedMessage request</param>
        private void VerifyRopOpenEmbeddedMessageSuccessResponse(RopOpenEmbeddedMessageResponse ropOpenEmbeddedMessageResponse, byte outputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2248");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2248
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.RopId.GetType(),
                2248,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2250
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopOpenEmbeddedMessage,
                ropOpenEmbeddedMessageResponse.RopId,
                2250,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,RopId (1 byte)]For this operation[RopOpenEmbeddedMessage], this field is set to 0x46.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2251
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.OutputHandleIndex.GetType(),
                2251,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]OutputHandleIndex (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2252
            Site.CaptureRequirementIfAreEqual<byte>(
                outputHandleIndex,
                ropOpenEmbeddedMessageResponse.OutputHandleIndex,
                2252,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,OutputHandleIndex (1 byte)]This index MUST be set to the value specified in the OutputHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2254
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropOpenEmbeddedMessageResponse.ReturnValue.GetType(),
                2254,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2256
            Site.CaptureRequirementIfAreEqual<uint>(
                SuccessReturnValue,
                ropOpenEmbeddedMessageResponse.ReturnValue,
                2256,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,ReturnValue (4 bytes)]For this response[Success Response ], this field is set to 0x00000000.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2257
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.Reserved.GetType(),
                2257,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]Reserved (1 byte): Reserved.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2258
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)ResponseFlags.None,
                ropOpenEmbeddedMessageResponse.Reserved,
                2258,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,Reserved (1 byte)]This field MUST be set to 0x00.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2259
            Site.CaptureRequirementIfAreEqual<int>(
                8,
                Marshal.SizeOf(ropOpenEmbeddedMessageResponse.MessageId),
                2259,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]MessageId (8 bytes): An identifier.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2261,HasNamedProperties:{0}", ropOpenEmbeddedMessageResponse.HasNamedProperties);

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2261
            // If HasNamedProperties is byte type and can be boolean type representation, then verify R2261
            bool isVerifyR2261 = (typeof(byte) == ropOpenEmbeddedMessageResponse.HasNamedProperties.GetType()) &&
                                 ((Convert.ToBoolean(ropOpenEmbeddedMessageResponse.HasNamedProperties) == true) ||
                                 (Convert.ToBoolean(ropOpenEmbeddedMessageResponse.HasNamedProperties) == false));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR2261,
                2261,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]HasNamedProperties (1 byte): A Boolean.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2263
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(TypedString),
                ropOpenEmbeddedMessageResponse.SubjectPrefix.GetType(),
                2263,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]SubjectPrefix (variable): A TypedString structure.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2266
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(TypedString),
                ropOpenEmbeddedMessageResponse.NormalizedSubject.GetType(),
                2266,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]NormalizedSubject (variable): A TypedString structure.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2269
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropOpenEmbeddedMessageResponse.RecipientCount.GetType(),
                2269,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]RecipientCount (2 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2271
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropOpenEmbeddedMessageResponse.ColumnCount.GetType(),
                2271,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]ColumnCount (2 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2273
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(PropertyTag[]),
                ropOpenEmbeddedMessageResponse.RecipientColumns.GetType(),
                2273,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]RecipientColumns (variable): An array of PropertyTag structures.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2274
            Site.CaptureRequirementIfAreEqual<ushort>(
                ropOpenEmbeddedMessageResponse.ColumnCount,
                (ushort)ropOpenEmbeddedMessageResponse.RecipientColumns.Length,
                2274,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,RecipientColumns (variable)]The number of structures contained in this field is specified by the ColumnCount field.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2277
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.RowCount.GetType(),
                2277,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]RowCount (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2280
            Site.CaptureRequirementIfAreEqual<byte>(
                ropOpenEmbeddedMessageResponse.RowCount,
                (byte)ropOpenEmbeddedMessageResponse.RecipientRows.Length,
                2280,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer,RecipientRows (variable)]The number of structures contained in this field[RecipientRows (variable)] is specified by the RowCount field.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2279
            Site.CaptureRequirementIfAreEqual<Type>(
                ropOpenEmbeddedMessageResponse.RecipientRows.GetType(),
                typeof(OpenRecipientRow[]),
                2279,
                @"[In RopOpenEmbeddedMessage ROP Success Response Buffer]RecipientRows (variable): A list of OpenRecipientRow structures.");
        }
        /// <summary>
        /// Verify the message of RopOpenEmbeddedMessageResponse
        /// </summary>
        /// <param name="ropOpenEmbeddedMessageResponse"> The message of RopOpenEmbeddedMessageResponse</param>
        /// <param name="mID"> MID for the Message object </param>
        private void VerifyDataStructureRopOpenEmbeddedMessageResponse(RopOpenEmbeddedMessageResponse ropOpenEmbeddedMessageResponse, ulong mID)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R889");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R889
            bool isVerifyR889 = ropOpenEmbeddedMessageResponse.MessageId.GetType() == typeof(ulong) && ropOpenEmbeddedMessageResponse.MessageId.ToString().IndexOf(mID.ToString()) >= 0;

            Site.CaptureRequirementIfIsTrue(
                isVerifyR889,
                889,
                @"[In RopOpenEmbeddedMessage ROP Response Buffer] MessageId: 8 bytes containing the MID ([MS-OXCDATA] section 2.2.1.2) for the Message object.");

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

            // Verify MS-OXCDATA requirement: MS-OXCDATA_R2180
            // The message ID should be 8 bytes when the ropOpenEmbeddedMessageResponse.MessageId is not null or empty, because the ReplicaId is 2 bytes and GlobalCounter is 6 bytes.
            this.Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropOpenEmbeddedMessageResponse.MessageId.GetType(),
                CdataShortName,
                2180,
                @"[In Message ID Structure] It [Message ID] is an 8-byte structure.");

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

            // Verify MS-OXCDATA requirement: MS-OXCDATA_R2181
            // The message ID should be 8 bytes when the ropOpenEmbeddedMessageResponse.MessageId is not null or empty, because the ReplicaId is 2 bytes and GlobalCounter is 6 bytes.
            this.Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropOpenEmbeddedMessageResponse.MessageId.GetType(),
                CdataShortName,
                2181,
                @"[In Message ID Structure] ReplicaId (2 bytes): An unsigned integer identifying a Store object.");

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

            // Verify MS-OXCDATA requirement: MS-OXCDATA_R2182
            // The message ID should be 8 bytes when the ropOpenEmbeddedMessageResponse.MessageId is not null or empty, because the ReplicaId is 2 bytes and GlobalCounter is 6 bytes.
            this.Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropOpenEmbeddedMessageResponse.MessageId.GetType(),
                CdataShortName,
                2182,
                @"[In Message ID Structure] GlobalCounter (6 bytes): An unsigned integer identifying the message within its Store object.");
        }
        /// <summary>
        /// Verify RopOpenEmbeddedMessage Failure Response
        /// </summary>
        /// <param name="ropOpenEmbeddedMessageResponse">The response of RopOpenEmbeddedMessage request</param>
        /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopOpenEmbeddedMessage request</param>
        private void VerifyRopOpenEmbeddedMessageFailureResponse(RopOpenEmbeddedMessageResponse ropOpenEmbeddedMessageResponse, byte outputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2282");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2282
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.RopId.GetType(),
                2282,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer]RopId (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2285
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopOpenEmbeddedMessage,
                ropOpenEmbeddedMessageResponse.RopId,
                2285,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopOpenEmbeddedMessage], this field is set to 0x46.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2286
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropOpenEmbeddedMessageResponse.OutputHandleIndex.GetType(),
                2286,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer]OutputHandleIndex (1 byte): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2287
            Site.CaptureRequirementIfAreEqual<byte>(
                outputHandleIndex,
                ropOpenEmbeddedMessageResponse.OutputHandleIndex,
                2287,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer,OutputHandleIndex (1 byte)]This index MUST be set to the value specified in the OutputHandleIndex field in the request.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2289
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropOpenEmbeddedMessageResponse.ReturnValue.GetType(),
                2289,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2291
            Site.CaptureRequirementIfAreNotEqual<uint>(
                SuccessReturnValue,
                ropOpenEmbeddedMessageResponse.ReturnValue,
                2291,
                @"[In RopOpenEmbeddedMessage ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response ], this field is set to a value other than 0x00000000.");
        }