/// <summary>
        /// Parse the Disconnect request type success response body.
        /// </summary>
        /// <param name="rawData">The raw data which is returned by server.</param>
        /// <returns>An instance of DisconnectSuccessResponseBody class.</returns>
        public static DisconnectSuccessResponseBody Parse(byte[] rawData)
        {
            DisconnectSuccessResponseBody responseBody = new DisconnectSuccessResponseBody();
            int index = 0;
            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize];
            Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize);

            return responseBody;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Verify the Disconnect success response body related requirements.
        /// </summary>
        /// <param name="disconnectSuccessResponseBody">The Disconnect success response body to be verified.</param>
        private void VerifyDisconnectSuccessResponseBody(DisconnectSuccessResponseBody disconnectSuccessResponseBody)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R281");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R281
            this.Site.CaptureRequirementIfIsInstanceOfType(
                disconnectSuccessResponseBody.StatusCode,
                typeof(uint),
                281,
                @"[In Disconnect Request Type Success Response Body] StatusCode (4 bytes): An unsigned integer that specifies the status of the request.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1363
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                disconnectSuccessResponseBody.StatusCode,
                1363,
                @"[In Disconnect Request Type Success Response Body] [StatusCode] This field MUST be set to 0x00000000.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R288
            this.Site.CaptureRequirementIfIsInstanceOfType(
                disconnectSuccessResponseBody.ErrorCode,
                typeof(uint),
                288,
                @"[In Disconnect Request Type Success Response Body] ErrorCode (4 bytes): An unsigned integer that specifies the return status of the operation.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R289
            this.Site.CaptureRequirementIfIsInstanceOfType(
                disconnectSuccessResponseBody.AuxiliaryBufferSize,
                typeof(uint),
                289,
                @"[In Disconnect Request Type Success Response Body] AuxiliaryBufferSize (4 bytes): An unsigned integer that specifies the size, in bytes, of the AuxiliaryBuffer field.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R290
            this.Site.CaptureRequirementIfIsInstanceOfType(
                disconnectSuccessResponseBody.AuxiliaryBuffer,
                typeof(byte[]),
                290,
                @"[In Disconnect Request Type Success Response Body] AuxiliaryBuffer (variable): An array of bytes that constitute the auxiliary payload data returned from the server.");

            // Add the debug information
            this.Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXCMAPIHTTP_R1365, the length of AuxiliaryBuffer is {0}, the value of AuxiliaryBufferSize is {1}.",
                disconnectSuccessResponseBody.AuxiliaryBuffer.Length,
                disconnectSuccessResponseBody.AuxiliaryBufferSize);

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1365
            this.Site.CaptureRequirementIfAreEqual<uint>(
                disconnectSuccessResponseBody.AuxiliaryBufferSize,
                (uint)disconnectSuccessResponseBody.AuxiliaryBuffer.Length,
                1365,
                @"[In Disconnect Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field.");
        }