コード例 #1
0
        /// <summary>
        /// This ROP creates a new attachment on a message. 
        /// </summary>
        /// <param name="handle">The handle to operate</param>
        /// <param name="createAttachmentResponse">The response of this ROP.</param>
        /// <param name="needVerify">Whether need to verify the response.</param>
        /// <returns>The index of the output handle for the response</returns>
        private uint RopCreateAttachment(uint handle, out RopCreateAttachmentResponse createAttachmentResponse, bool needVerify)
        {
            this.rawDataValue = null;
            this.responseValue = null;
            this.responseSOHsValue = null;

            RopCreateAttachmentRequest createAttachmentRequest = new RopCreateAttachmentRequest()
            {
                RopId = (byte)RopId.RopCreateAttachment,
                LogonId = LogonId,
                InputHandleIndex = (byte)HandleIndex.FirstIndex,
                OutputHandleIndex = (byte)HandleIndex.SecondIndex,
            };

            this.responseSOHsValue = this.ProcessSingleRop(createAttachmentRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            createAttachmentResponse = (RopCreateAttachmentResponse)this.responseValue;
            if (needVerify)
            {
                this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, createAttachmentResponse.ReturnValue, string.Format("RopCreateAttachmentResponse Failed! Error: 0x{0:X8}", createAttachmentResponse.ReturnValue));
            }

            return this.responseSOHsValue[0][createAttachmentResponse.OutputHandleIndex];
        }
コード例 #2
0
        /// <summary>
        /// Verify the message of RopCreateAttachmentResponse
        /// </summary>
        /// <param name="ropCreateAttachmentResponse"> The message of RopCreateAttachmentResponse </param>
        /// <param name="nID"> ID for the Attachment object </param>
        private void VerifyDataStructureRopCreateAttachmentResponse(RopCreateAttachmentResponse ropCreateAttachmentResponse, int nID)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R867");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R867
            bool isVerifyR867 = ropCreateAttachmentResponse.AttachmentID.GetType() == typeof(uint) && ropCreateAttachmentResponse.AttachmentID == nID;

            Site.CaptureRequirementIfIsTrue(
                isVerifyR867,
                867,
                @"[In RopCreateAttachment ROP Response Buffer] AttachmentID: 4 bytes containing the ID for the Attachment object that was created.");
        }
コード例 #3
0
        /// <summary>
        /// Verify RopCreateAttachment Success Response
        /// </summary>
        /// <param name="ropCreateAttachmentResponse">The response of RopCreateAttachment request</param>
        /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopCreateAttachment request</param>
        private void VerifyRopCreateAttachmentSuccessResponse(RopCreateAttachmentResponse ropCreateAttachmentResponse, byte outputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2164");

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2166
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopCreateAttachment,
                ropCreateAttachmentResponse.RopId,
                2166,
                @"[In RopCreateAttachment ROP Success Response Buffer,RopId (1 byte)]For this operation[ RopCreateAttachment], this field is set to 0x23.");

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

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2168
            Site.CaptureRequirementIfAreEqual<byte>(
                outputHandleIndex,
                ropCreateAttachmentResponse.OutputHandleIndex,
                2168,
                @"[In RopCreateAttachment 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_R2170");

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2172
            Site.CaptureRequirementIfAreEqual<uint>(
                SuccessReturnValue,
                ropCreateAttachmentResponse.ReturnValue,
                2172,
                @"[In RopCreateAttachment 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_R2173");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2173
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropCreateAttachmentResponse.AttachmentID.GetType(),
                2173,
                @"[In RopCreateAttachment ROP Success Response Buffer]AttachmentID (4 bytes): An unsigned integer identifier.");
        }
コード例 #4
0
        /// <summary>
        /// Verify RopCreateAttachment Failure Response
        /// </summary>
        /// <param name="ropCreateAttachmentResponse">The response of RopCreateAttachment request</param>
        /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopCreateAttachment request</param>
        private void VerifyRopCreateAttachmentFailureResponse(RopCreateAttachmentResponse ropCreateAttachmentResponse, byte outputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2176");

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2178
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopCreateAttachment,
                ropCreateAttachmentResponse.RopId,
                2178,
                @"[In RopCreateAttachment ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopCreateAttachment], this field is set to 0x23.");

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

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2180
            Site.CaptureRequirementIfAreEqual<byte>(
                outputHandleIndex,
                ropCreateAttachmentResponse.OutputHandleIndex,
                2180,
                @"[In RopCreateAttachment ROP Failure Response Buffer,OutputHandleIndex (1 byte)]This index that 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_R2182");

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

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

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R2184
            Site.CaptureRequirementIfAreNotEqual<uint>(
                SuccessReturnValue,
                ropCreateAttachmentResponse.ReturnValue,
                2184,
                @"[In RopCreateAttachment ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response ], this field is set to a value other than 0x00000000.");
        }
コード例 #5
0
        /// <summary>
        /// Create an attachment of the given message.
        /// </summary>
        /// <param name="objectHandle">A Server object handle.</param>
        /// <param name="createAttachmentResponse">The RopCreateAttachmentResponse value.</param>
        /// <param name="attachmentId">The created attachment ID.</param>
        /// <returns>A Server object handle of the created attachment.</returns>
        protected uint CreateAttachment(uint objectHandle, out RopCreateAttachmentResponse createAttachmentResponse, out uint attachmentId)
        {
            RopCreateAttachmentRequest createAttachmentRequest = new RopCreateAttachmentRequest()
            {
                RopId = (byte)RopId.RopCreateAttachment,
                LogonId = CommonLogonId,
                InputHandleIndex = CommonInputHandleIndex,
                OutputHandleIndex = CommonOutputHandleIndex
            };
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(createAttachmentRequest, objectHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            createAttachmentResponse = (RopCreateAttachmentResponse)this.response;
            Site.Assert.AreEqual<uint>(TestSuiteBase.Success, createAttachmentResponse.ReturnValue, "Call RopCreateAttachment should success.");
            attachmentId = createAttachmentResponse.AttachmentID;

            return this.ResponseSOHs[0][createAttachmentResponse.OutputHandleIndex];
        }