Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.STAT.InitiateStat C# (CSharp) Method

InitiateStat() public method

Initiate the stat to initial values.
public InitiateStat ( ) : void
return void
        public void InitiateStat()
        {
            this.CodePage = (uint)RequiredCodePages.CP_TELETEX;
            this.CurrentRec = (uint)MinimalEntryIDs.MID_BEGINNING_OF_TABLE;
            this.ContainerID = 0;
            this.Delta = 0;
            this.NumPos = 0;
            this.SortLocale = (uint)DefaultLCID.NSPI_DEFAULT_LOCALE;
            this.SortType = (uint)TableSortOrders.SortTypeDisplayName;
            this.TemplateLocale = (uint)DefaultLCID.NSPI_DEFAULT_LOCALE;
            this.TotalRecs = 0;
        }

Usage Example

        public void MSOXCMAPIHTTP_S02_TC01_BindAndUnbind()
        {
            this.CheckMapiHttpIsSupported();

            #region Call Bind request type with flags field set to 0x0 to established a session context with the address book server.

            // A STAT structure ([MS-OXNSPI] section 2.3.7) that specifies the state of a specific address book container. 
            STAT stat = new STAT();
            stat.InitiateStat();

            // A set of bit flags that specify the authentication type for the connection. The server MUST ignore values other than the bit flag fAnonymousLogin (0x00000020).
            uint flags = 0x0;
            BindRequestBody bindRequestBody = this.BuildBindRequestBody(stat, flags);

            int responseCode;
            BindResponseBody bindResponseBody = this.Adapter.Bind(bindRequestBody, out responseCode);
            Site.Assert.AreEqual<uint>(0, bindResponseBody.ErrorCode, "Bind should succeed and 0 is expected to be returned. The returned value is {0}.", bindResponseBody.ErrorCode);

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R324
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                bindResponseBody.ErrorCode,
                324,
                @"[In Bind Request Type] The Bind request type is used by the client to establish a Session Context with the server, as specified in section 3.1.4.1.1 and section 3.1.4.1.1");
            
            #endregion

            #region Call Bind request type with flags field set to another value other than fAnonymousLogin (0x00000020) to check that server will return the same result.

            // A set of bit flags that specify the authentication type for the connection. The server MUST ignore values other than the bit flag fAnonymousLogin (0x00000020).
            flags = 0x01;
            bindRequestBody.Flags = flags;
            BindResponseBody bindResponseBodyWithDifferentFlags = this.Adapter.Bind(bindRequestBody, out responseCode);
            Site.Assert.AreEqual<uint>(0, bindResponseBody.ErrorCode, "Bind should succeed and 0 is expected to be returned. The returned value is {0}.", bindResponseBody.ErrorCode);

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1320
            this.Site.CaptureRequirementIfAreEqual<uint>(
                bindResponseBody.ErrorCode,
                bindResponseBodyWithDifferentFlags.ErrorCode,
                1320,
                @"[In Bind Request Type Request Body] If this field [Flags] is set to different values other than the bit flag fAnonymousLogin (0x00000020), the server will return the same result.");
            #endregion

            #region Send a PING request to address book server endpoint.
            List<string> metatagsFromMailbox = new List<string>();
            WebHeaderCollection headers = new WebHeaderCollection();
            uint pingResponseCode = this.Adapter.PING(ServerEndpoint.AddressBookServerEndpoint, out metatagsFromMailbox, out headers);
            Site.Assert.AreEqual<uint>(0, pingResponseCode, "PING should succeed and 0 is expected to be returned. The returned Value is {0}.", pingResponseCode);
            #endregion

            #region Call the Unbind request type to destroy the session context.
            UnbindRequestBody unbindRequest = this.BuildUnbindRequestBody();
            UnbindResponseBody unbindResponseBody = this.Adapter.Unbind(unbindRequest);
            Site.Assert.AreEqual<uint>(1, unbindResponseBody.ErrorCode, "Unbind should succeed and 0 is expected to be returned. The returned value is {0}.", unbindResponseBody.ErrorCode);

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1438
            // The above assert ensures that the Unbind request type executes successfully, so R1250 can be verified if the Unbind response body is not null.
            this.Site.CaptureRequirementIfIsNotNull(
                unbindResponseBody,
                1438,
                @"[In Responding to a Disconnect or Unbind Request Type Request] If successful, the server's response includes the Unbind request type success response body, as specified in section 2.2.5.2.2.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R353
            this.Site.CaptureRequirementIfAreEqual<uint>(
                1,
                unbindResponseBody.ErrorCode,
                353,
                @"[In Unbind Request Type] The Unbind request type is used by the client to delete a Session Context with the server, as specified in section 3.1.4.1.2.");

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1441
            // The cookies returned from Bind request type is used by Unbind request type, so if the Unbind request type executes successfully and the Bind response body is not null, R1441 can be verified.
            this.Site.CaptureRequirementIfIsNotNull(
                bindResponseBody,
                1441,
                @"[In Responding to a Connect or Bind Request Type Request] If successful, the server's response includes the Bind request type response body as specified in section 2.2.5.1.2.");
            #endregion
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.STAT::InitiateStat