Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.S02_RequestTypesForAddressBookServerEndpoint.MSOXCMAPIHTTP_S02_TC04_DnToMinId C# (CSharp) Method

MSOXCMAPIHTTP_S02_TC04_DnToMinId() private method

private MSOXCMAPIHTTP_S02_TC04_DnToMinId ( ) : void
return void
        public void MSOXCMAPIHTTP_S02_TC04_DnToMinId()
        {
            this.CheckMapiHttpIsSupported();

            #region Call Bind request type to established a session context with the address book server.
            this.Bind();
            #endregion

            #region Call DnToMinId request type to map a set of DNs to a set of Minimal Entry IDs.
            // Reserved. The client MUST set this field to 0x00000000 and the server MUST ignore this field.
            uint reserved = 0;
            byte[] auxIn = new byte[] { };
            DNToMinIdRequestBody requestBodyOfDNToMId = new DNToMinIdRequestBody()
            {
                Reserved = reserved,
                HasNames = true,
                Names = new StringArray_r
                {
                    CValues = 1,
                    LppzA = new string[]
                    {
                        this.AdminUserDN
                    }
                },
                AuxiliaryBuffer = auxIn,
                AuxiliaryBufferSize = (uint)auxIn.Length
            };

            DnToMinIdResponseBody responseBodyOfDNToMinId = this.Adapter.DnToMinId(requestBodyOfDNToMId);
            Site.Assert.AreEqual<uint>(0, responseBodyOfDNToMinId.ErrorCode, "DnToMinId should succeed and 0 is expected to be returned. The returned value is {0}.", responseBodyOfDNToMinId.ErrorCode);

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R405
            // The client defines a set of DNs, if there is MinimalIds, it indicates that the client maps a set of DNs (1) to a set of Minimal Entry IDs successfully.
            this.Site.CaptureRequirementIfIsNotNull(
                responseBodyOfDNToMinId.MinimalIds,
                405,
                @"[In DnToMinId Request Type] The DnToMinId request type is used by the client to map a set of DNs (1) to a set of Minimal Entry IDs.");

            // Add the debug information
            this.Site.Log.Add(
                LogEntryKind.Debug,
                "Verify MS-OXCMAPIHTTP_R436, the value of MinimalIdCount is {0}, the value of MinimalIds is {1}.",
                responseBodyOfDNToMinId.MinimalIdCount,
                responseBodyOfDNToMinId.MinimalIds);

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R436
            this.Site.CaptureRequirementIfIsTrue(
                responseBodyOfDNToMinId.MinimalIdCount == requestBodyOfDNToMId.Names.CValues && responseBodyOfDNToMinId.MinimalIds != null,
                436,
                @"[In DnToMinId Request Type Success Response Body] MinimalIds (optional) (variable): An array of MinimalEntryID structures ([MS-OXNSPI] section 2.3.8.1), each of which specifies a Minimal Entry ID that matches a requested distinguished name (DN) (1).");
            #endregion

            #region Call DnToMinId request body with HasNames set to false.
            requestBodyOfDNToMId = new DNToMinIdRequestBody()
            {
                Reserved = reserved,
                HasNames = false,
                AuxiliaryBuffer = auxIn,
                AuxiliaryBufferSize = (uint)auxIn.Length
            };

            responseBodyOfDNToMinId = this.Adapter.DnToMinId(requestBodyOfDNToMId);
            Site.Assert.AreEqual<uint>(0, responseBodyOfDNToMinId.ErrorCode, "DnToMinId should succeed and 0 is expected to be returned. The returned value is {0}.", responseBodyOfDNToMinId.ErrorCode);
            #endregion

            #region Call the Unbind request type to destroy the session context.
            this.Unbind();
            #endregion
        }