Microsoft.Protocols.TestSuites.MS_OXNSPI.S05_NegativeBehavior.MSOXNSPI_S05_TC34_NspiSeekEntriesFaliure C# (CSharp) Method

MSOXNSPI_S05_TC34_NspiSeekEntriesFaliure() private method

private MSOXNSPI_S05_TC34_NspiSeekEntriesFaliure ( ) : void
return void
        public void MSOXNSPI_S05_TC34_NspiSeekEntriesFaliure()
        {
            this.CheckProductSupported();
            this.CheckMAPIHTTPTransportSupported();

            #region Call NspiBind to initiate a session between the client and the server.
            uint flags = 0;
            STAT stat = new STAT();
            stat.InitiateStat();

            FlatUID_r guid = new FlatUID_r
            {
                Ab = new byte[16]
            };

            FlatUID_r? serverGuid = guid;

            this.Result = this.ProtocolAdatper.NspiBind(flags, stat, ref serverGuid);
            Site.Assert.AreEqual(ErrorCodeValue.Success, this.Result, "NspiBind should return success!");
            #endregion

            #region Call NspiGetMatches method with specified filter and prop tags.
            uint reserved1 = 0;
            uint reserver2 = 0;
            PropertyTagArray_r? proReserved = null;
            uint requested = Constants.GetMatchesRequestedRowNumber;

            Restriction_r contentRestriction = new Restriction_r
            {
                Rt = 0x03,
                Res = new RestrictionUnion_r
                {
                    ResContent = new ContentRestriction_r
                    {
                        FuzzyLevel = 0x00010002
                    }
                }
            };

            PropertyValue_r target = new PropertyValue_r
            {
                PropTag = (uint)AulProp.PidTagDisplayName,
                Reserved = 0
            };
            string displayName = Common.GetConfigurationPropertyValue("DistributionListName", this.Site);
            target.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName);
            if (this.Transport == "ncacn_http" || this.Transport == "ncacn_ip_tcp")
            {
                target.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName);
            }
            else
            {
                target.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName + "\0");
            }

            contentRestriction.Res.ResContent.Prop = new PropertyValue_r[] { target };
            contentRestriction.Res.ResContent.PropTag = (uint)AulProp.PidTagDisplayName;
            Restriction_r? filter = contentRestriction;

            PropertyTagArray_r propTags1 = new PropertyTagArray_r
            {
                CValues = 1,
                AulPropTag = new uint[]
                {
                    (uint)AulProp.PidTagDisplayName
                }
            };
            PropertyTagArray_r? propTagsOfGetMatches = propTags1;

            PropertyName_r? propNameOfGetMatches = null;
            PropertyTagArray_r? outMIds;
            PropertyRowSet_r? rowsOfGetMatches;

            this.Result = this.ProtocolAdatper.NspiGetMatches(reserved1, ref stat, proReserved, reserver2, filter, propNameOfGetMatches, requested, out outMIds, propTagsOfGetMatches, out rowsOfGetMatches);
            Site.Assert.AreEqual(ErrorCodeValue.Success, this.Result, "NspiGetMatches should return success!");
            #endregion

            #region Call NspiSeekentries method with input parameter lpETable is not set to null.
            PropertyValue_r propertyTarget = new PropertyValue_r
            {
                PropTag = (uint)AulProp.PidTagDisplayName,
                Reserved = (uint)0x00
            };
            if (this.Transport == "ncacn_http" || this.Transport == "ncacn_ip_tcp")
            {
                propertyTarget.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName);
            }
            else
            {
                propertyTarget.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName + "\0");
            }

            target.Value.LpszA = System.Text.Encoding.UTF8.GetBytes(displayName);
            propertyTarget.PropTag = (uint)AulProp.PidTagDisplayName;
            PropertyTagArray_r? table = outMIds;
            PropertyTagArray_r? propertyTags = null;
            PropertyRowSet_r? rowsOfSeekEntries;
            this.Result = this.ProtocolAdatper.NspiSeekEntries(reserved1, ref stat, propertyTarget, table, propertyTags, out rowsOfSeekEntries, false);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXNSPI_R1020, the value of the result is {0}", this.Result);

            // Verify MS-OXNSPI requirement: MS-OXNSPI_R1020
            Site.CaptureRequirementIfIsTrue(
                Enum.IsDefined(typeof(ErrorCodeValue), this.Result),
                1020,
                @"[In NspiSeekEntries] [Server Processing Rules: Upon receiving message NspiSeekEntries, the server MUST process the data from the message subject to the following constraints:] [Constraint 2] If the input parameter lpETable is not NULL and does not contain an Explicit Table both containing a restriction of the table specified by the input parameter pStat and sorted as specified by the SortType field of the input parameter pStat, the server MUST return one of the return values [Success, UnbindSuccess, UnbindFailure, ErrorsReturned, GeneralFailure, NotSupported, InvalidObject, OutOfResources, NotFound, LogonFailed, TooComplex, InvalidCodepage, InvalidLocale, TableTooBig, InvalidBookmark, AccessDenied, NotEnoughMemory and InvalidParameter] specified in section 2.2.1.2.");
            #endregion

            #region Call NspiSeekentries method and the input parameter STAT block specifies SortTypePhoneticDisplayName and the property specified in the input parameter pTarget is PidTagEntryId.
            propTags1 = new PropertyTagArray_r
            {
                CValues = 1,
                AulPropTag = new uint[]
                {
                    (uint)AulProp.PidTagEntryId
                }
            };
            propertyTags = propTags1;

            stat.SortType = (uint)TableSortOrder.SortTypePhoneticDisplayName;
            this.Result = this.ProtocolAdatper.NspiSeekEntries(reserved1, ref stat, propertyTarget, table, propertyTags, out rowsOfSeekEntries, false);

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

            // Verify MS-OXNSPI requirement: MS-OXNSPI_R1045
            Site.CaptureRequirementIfAreEqual<ErrorCodeValue>(
                ErrorCodeValue.GeneralFailure,
                this.Result,
                1045,
                @"[In NspiSeekEntries] [Server Processing Rules: Upon receiving message NspiSeekEntries, the server MUST process the data from the message subject to the following constraints:] [Constraint 12] If the SortType field in the input parameter pStat is SortTypePhoneticDisplayName and the property specified in the input parameter pTarget is anything other than PidTagAddressBookPhoneticDisplayName (with either the Property Type PtypString8 or PtypString), the server MUST return the value GeneralFailure.");
            #endregion

            #region Call NspiUnbind method to destroy the context handle.
            uint returnValue = this.ProtocolAdatper.NspiUnbind(0);
            Site.Assert.AreEqual<uint>(1, returnValue, "NspiUnbind method should return 1 (Success).");
            #endregion
        }
S05_NegativeBehavior