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

MSOXCMAPIHTTP_S01_TC04_SendInvalidContextCookie() private method

private MSOXCMAPIHTTP_S01_TC04_SendInvalidContextCookie ( ) : void
return void
        public void MSOXCMAPIHTTP_S01_TC04_SendInvalidContextCookie()
        {
            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.");
            Site.Assert.IsTrue(
                AdapterHelper.SessionContextCookies.Count > 0,
                "The server should return Session Context cookie if server creates new Session Context successfully. The count of the cookie is {0}",
                AdapterHelper.SessionContextCookies.Count);
            #endregion

            #region Send an Execute request which includes an invalid session context cookie.
            CookieCollection invalidCookies = new CookieCollection();
            for (int i = 0; i < AdapterHelper.SessionContextCookies.Count; i++)
            {
                Cookie cookie = new Cookie()
                {
                    Domain = Common.GetConfigurationPropertyValue("Domain", this.Site),
                    Name = AdapterHelper.SessionContextCookies[i].Name,
                    Value = "Invalid cookie"
                };
                invalidCookies.Add(cookie);
            }

            uint responseCodeInvalidCookie = this.ExecuteLogonROP(invalidCookies);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R142");
        
            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R142
            this.Site.CaptureRequirementIfAreEqual<uint>(
                6,
                responseCodeInvalidCookie,
                142,
                @"[In X-ResponseCode Header Field] Invalid Context Cookie (6): The request has an invalid session context cookie.");
            #endregion

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