public void MSOXCMAPIHTTP_S01_TC03_ResponseCodeHeader()
{
this.CheckMapiHttpIsSupported();
WebHeaderCollection headers = new WebHeaderCollection();
MailboxResponseBodyBase responseBody;
#region Send a Connect request to establish a Session Context with the server.
ConnectSuccessResponseBody connectResponse = this.ConnectToServer(out headers);
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R133");
// Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R133
this.Site.CaptureRequirementIfAreEqual<uint>(
0,
AdapterHelper.GetFinalResponseCode(headers["X-ResponseCode"]),
133,
@"[In X-ResponseCode Header Field] An X-ResponseCode of 0 (zero) means success from the perspective of the protocol transport.");
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R136");
// Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R136
this.Site.CaptureRequirementIfAreEqual<uint>(
0,
AdapterHelper.GetFinalResponseCode(headers["X-ResponseCode"]),
136,
@"[In X-ResponseCode Header Field] Success (0): The request was properly formatted and accepted.");
Site.Assert.IsNotNull(connectResponse, "The response body should be parsed succeeded if the X-ResponseCode header is 0");
// According to steps above, when the X-ResponseCode is 0, server return the valid response body that is parsed by client.
// So MS-OXCMAPIHTTP_R55 can be verified.
this.Site.CaptureRequirement(
55,
@"[In Common Response Format] An X-ResponseCode of 0 (zero) means success from the perspective of the protocol transport, and the client parses the RESPONSE BODY based on the request that was issued.");
#endregion
#region Send an Execute request which includes an invalid X-RequestType header.
WebHeaderCollection executeHeaders = AdapterHelper.InitializeHTTPHeader(RequestType.Execute, Guid.NewGuid().ToString(), 1);
executeHeaders.Set("X-RequestType", "invalidValue");
ExecuteRequestBody requestBody = this.InitializeExecuteRequestBody(this.GetRopLogonRequest());
List<string> metaTags = new List<string>();
responseBody = this.SendExecuteRequest(requestBody, ref executeHeaders, out metaTags);
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R141");
// Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R141
this.Site.CaptureRequirementIfAreEqual<uint>(
5,
AdapterHelper.GetFinalResponseCode(executeHeaders["X-ResponseCode"]),
141,
@"[In X-ResponseCode Header Field] Invalid Request Type (5): The request has an invalid X-RequestType header.");
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2232");
// Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2232
this.Site.CaptureRequirementIfIsNull(
responseBody,
2232,
@"[In Responding to All Request Type Requests] If an additional X-ResponseCode header is returned and if it indicates a failure, then the response body can be empty or can include failure data in a format that is specified by an additional Content-Type header as specified in section 2.2.3.2.2.");
#endregion
#region Send an Execute request which misses cookie.
uint responseCodeMissCookie = this.ExecuteLogonROP(new CookieCollection());
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R149");
// Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R149
this.Site.CaptureRequirementIfAreEqual<uint>(
13,
responseCodeMissCookie,
149,
@"[In X-ResponseCode Header Field] Missing Cookie (13): The request is missing a required cookie.");
#endregion
#region Send a Disconnect request to destroy the Session Context.
this.Adapter.Disconnect(out responseBody);
#endregion
}