/// <summary> /// This method is used by the client to delete a Session Context with the Address Book Server. /// </summary> /// <param name="unbindRequestBody">The unbind request type request body.</param> /// <returns>The response body of unbind request type.</returns> public UnbindResponseBody Unbind(UnbindRequestBody unbindRequestBody) { CommonResponse commonResponse = this.SendAddressBookRequest(unbindRequestBody, RequestType.Unbind); AdapterHelper.SessionContextCookies = new CookieCollection(); UnbindResponseBody unbindResponseBody = UnbindResponseBody.Parse(commonResponse.ResponseBodyRawData); this.VerifyUnbindResponseBody(unbindResponseBody); return(unbindResponseBody); }
/// <summary> /// Parse the Unbind request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The Unbind request type response body.</returns> public static UnbindResponseBody Parse(byte[] rawData) { UnbindResponseBody responseBody = new UnbindResponseBody(); 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; }
/// <summary> /// Parse the Unbind request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The Unbind request type response body.</returns> public static UnbindResponseBody Parse(byte[] rawData) { UnbindResponseBody responseBody = new UnbindResponseBody(); 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); }
/// <summary> /// Verify the Unbind response body related requirements. /// </summary> /// <param name="unbindResponseBody">The Unbind response body to be verified.</param> private void VerifyUnbindResponseBody(UnbindResponseBody unbindResponseBody) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R367"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R367 this.Site.CaptureRequirementIfIsInstanceOfType( unbindResponseBody.StatusCode, typeof(uint), 367, @"[In Unbind 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_R1291"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1291 this.Site.CaptureRequirementIfAreEqual<uint>( 0, unbindResponseBody.StatusCode, 1291, @"[In Unbind 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_R368"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R368 this.Site.CaptureRequirementIfIsInstanceOfType( unbindResponseBody.ErrorCode, typeof(uint), 368, @"[In Unbind 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_R369"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R369 this.Site.CaptureRequirementIfIsInstanceOfType( unbindResponseBody.AuxiliaryBufferSize, typeof(uint), 369, @"[In Unbind 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_R370"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R370 this.Site.CaptureRequirementIfIsInstanceOfType( unbindResponseBody.AuxiliaryBuffer, typeof(byte[]), 370, @"[In Unbind 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_R371"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R371 this.Site.CaptureRequirementIfAreEqual<uint>( unbindResponseBody.AuxiliaryBufferSize, (uint)unbindResponseBody.AuxiliaryBuffer.Length, 371, @"[In Unbind Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field."); }