Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.S01_RequestTypesForMailboxServerEndpoint.MSOXCMAPIHTTP_S01_TC05_SendInvalidRequestBody C# (CSharp) Method

MSOXCMAPIHTTP_S01_TC05_SendInvalidRequestBody() private method

private MSOXCMAPIHTTP_S01_TC05_SendInvalidRequestBody ( ) : void
return void
        public void MSOXCMAPIHTTP_S01_TC05_SendInvalidRequestBody()
        {
            this.CheckMapiHttpIsSupported();
            WebHeaderCollection headers = new WebHeaderCollection();
            MailboxResponseBodyBase responseBody;

            #region Send a valid Connect request type to establish a Session Context with the server.
            ConnectSuccessResponseBody connectResponse = this.ConnectToServer(out headers);
            Site.Assert.AreEqual<uint>(0, connectResponse.StatusCode, "The server should return a Status 0 in X-ResponseCode header if client connect to server succeeded.");
            #endregion

            #region Send an Execute request includes an invalid request body.
            WebHeaderCollection executeHeaders = AdapterHelper.InitializeHTTPHeader(RequestType.Execute, AdapterHelper.ClientInstance, AdapterHelper.Counter);

            byte[] ropBuffer = RopBufferHelper.BuildRequestBuffer(this.GetRopLogonRequest(), 0);

            // Construct an invalid request body that RopBuffer is null and the RopBufferSize is not zero.
            ExecuteRequestBody invalidRequestBody = new ExecuteRequestBody();
            invalidRequestBody.Flags = 0x00000003;
            invalidRequestBody.RopBufferSize = (uint)ropBuffer.Length;
            invalidRequestBody.RopBuffer = new byte[] { };
            invalidRequestBody.MaxRopOut = 0x10008;
            invalidRequestBody.AuxiliaryBufferSize = 0;
            invalidRequestBody.AuxiliaryBuffer = new byte[] { };

            List<string> metaTags = new List<string>();
            responseBody = this.SendExecuteRequest(invalidRequestBody, ref executeHeaders, out metaTags);
           
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R148");
        
            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R148
            this.Site.CaptureRequirementIfAreEqual<uint>(
                12,
                AdapterHelper.GetFinalResponseCode(executeHeaders["X-ResponseCode"]),
                148,
                @"[In X-ResponseCode Header Field] Invalid Request Body (12): The request body is invalid.");
            #endregion

            #region Send a Disconnect request to destroy the Session Context.
            this.Adapter.Disconnect(out responseBody);
            #endregion
        }