A class indicates the response body of Update STAT request
Inheritance: AddressBookResponseBodyBase
コード例 #1
0
        /// <summary>
        /// This method is used by the client to update the STAT structure to reflect the client's changes.
        /// </summary>
        /// <param name="updateStatRequestBody">The UpdateStat request type request body.</param>
        /// <returns>The response body of UpdateStat request type.</returns>
        public UpdateStatResponseBody UpdateStat(UpdateStatRequestBody updateStatRequestBody)
        {
            CommonResponse         commonResponse         = this.SendAddressBookRequest(updateStatRequestBody, RequestType.UpdateStat);
            UpdateStatResponseBody updateStatResponseBody = UpdateStatResponseBody.Parse(commonResponse.ResponseBodyRawData);

            this.VerifyUpdateStatResponseBody(updateStatResponseBody);

            return(updateStatResponseBody);
        }
コード例 #2
0
        /// <summary>
        /// Parse the UpdateStat request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The UpdateStat request type response body.</returns>
        public static UpdateStatResponseBody Parse(byte[] rawData)
        {
            UpdateStatResponseBody responseBody = new UpdateStatResponseBody();
            int index = 0;

            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.HasState = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);

            if (responseBody.HasState)
            {
                responseBody.State = STAT.Parse(rawData, ref index);
            }
            else
            {
                responseBody.State = null;
            }

            responseBody.HasDelta = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasDelta)
            {
                responseBody.Delta = BitConverter.ToInt32(rawData, index);
                index += sizeof(int);
            }
            else
            {
                responseBody.Delta = null;
            }

            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);
        }
コード例 #3
0
        /// <summary>
        /// Parse the UpdateStat request type response body.
        /// </summary>
        /// <param name="rawData">The raw data of response.</param>
        /// <returns>The UpdateStat request type response body.</returns>
        public static UpdateStatResponseBody Parse(byte[] rawData)
        {
            UpdateStatResponseBody responseBody = new UpdateStatResponseBody();
            int index = 0;
            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.HasState = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);

            if (responseBody.HasState)
            {
                responseBody.State = STAT.Parse(rawData, ref index);
            }
            else
            {
                responseBody.State = null;
            }

            responseBody.HasDelta = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasDelta)
            {
                responseBody.Delta = BitConverter.ToInt32(rawData, index);
                index += sizeof(int);
            }
            else
            {
                responseBody.Delta = null;
            }

            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;
        }
コード例 #4
0
        /// <summary>
        ///  Verify the UpdateStat response body related requirements.
        /// </summary>
        /// <param name="updateStatResponseBody">The UpdateStat response body to be verified.</param>
        private void VerifyUpdateStatResponseBody(UpdateStatResponseBody updateStatResponseBody)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1074");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1074
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.StatusCode,
                typeof(uint),
                1074,
                @"[In UpdateStat 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_R1075");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1075
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                updateStatResponseBody.StatusCode,
                1075,
                @"[In UpdateStat 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_R1076");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1076
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.ErrorCode,
                typeof(uint),
                1076,
                @"[In UpdateStat 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_R1077");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1077
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.HasState,
                typeof(bool),
                1077,
                @"[In UpdateStat Request Type Success Response Body] HasState (1 byte): A Boolean value that specifies whether the State field is present.");

            if (updateStatResponseBody.HasState)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1078");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1078
                this.Site.CaptureRequirementIfIsInstanceOfType(
                    updateStatResponseBody.State,
                    typeof(STAT),
                    1078,
                    @"[In UpdateStat Request Type Success Response Body] State (optional) (36 bytes): A STAT structure ([MS-OXNSPI] section 2.3.7) that specifies the state of a specific address book container.");

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

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1080
                this.Site.CaptureRequirementIfIsNotNull(
                    updateStatResponseBody.State,
                    1080,
                    @"[In UpdateStat Request Type Success Response Body] [State] This field is present when the HasState field is nonzero.");
            }
            else
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1081");
        
                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1081
                this.Site.CaptureRequirementIfIsNull(
                    updateStatResponseBody.State,
                    1081,
                    @"[In UpdateStat Request Type Success Response Body] [State] This field is not present when the HasState field is zero.");
            }

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1082
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.HasDelta,
                typeof(bool),
                1082,
                @"[In UpdateStat Request Type Success Response Body] HasDelta (1 byte): A Boolean value that specifies whether the Delta field is present.");

            if (updateStatResponseBody.HasDelta)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1084");
        
                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1084
                this.Site.CaptureRequirementIfIsNotNull(
                    updateStatResponseBody.Delta,
                    1084,
                    @"[In UpdateStat Request Type Success Response Body] [Delta] This field is present when the value of the HasDelta field is nonzero.");
            }
            else
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1085");
        
                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1085
                this.Site.CaptureRequirementIfIsNull(
                    updateStatResponseBody.Delta,
                    1085,
                    @"[In UpdateStat Request Type Success Response Body] [Delta] This field is not present when the value of the HasDelta field is zero.");
            }

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1086
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.AuxiliaryBufferSize,
                typeof(uint),
                1086,
                @"[In UpdateStat 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_R1087");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1087
            this.Site.CaptureRequirementIfIsInstanceOfType(
                updateStatResponseBody.AuxiliaryBuffer,
                typeof(byte[]),
                1087,
                @"[In UpdateStat 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_R1088");

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