Microsoft.Protocols.TestSuites.MS_OXORULE.MS_OXORULEAdapter.VerifyPropertiesInTable C# (CSharp) Method

VerifyPropertiesInTable() private method

Verify the RopGetProperties in Rules Table.
private VerifyPropertiesInTable ( PropertyTag propertyTags, RopQueryRowsResponse quertyRowsResponse ) : void
propertyTags Microsoft.Protocols.TestSuites.Common.PropertyTag PropertyTag array.
quertyRowsResponse Microsoft.Protocols.TestSuites.Common.RopQueryRowsResponse Response of quertyRows.
return void
        private void VerifyPropertiesInTable(PropertyTag[] propertyTags, RopQueryRowsResponse quertyRowsResponse)
        {
            // propertyTags contains a list of PropertyTag.
            for (int i = 0; i < propertyTags.Length; i++)
            {
                // propertyId indicates the Id of a property.
                ushort propertyId = propertyTags[i].PropertyId;

                // propertyType indicates the Type of a property.
                ushort propertyType = propertyTags[i].PropertyType;

                // propertyValue indicates the value of a property.
                byte[] propertyValue = quertyRowsResponse.RowData.PropertyRows[quertyRowsResponse.RowData.PropertyRows.Count - 1].PropertyValues[i].Value;

                // If propertyId is 0x6674, it means the property is PidTagRuleId.
                if (propertyId == 0x6674)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2699", "The length({0}) of the propertyValue should be 8 and the value of the propertyType({1}) should be 0x0014.", propertyValue.Length, propertyType);

                    // Verify MS-OXCDATA requirement: MS-OXCDATA_R2699.
                    bool isVerifyR2699 = propertyValue.Length == 8 && propertyType == 0x0014;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR2699,
                        "MS-OXCDATA",
                        2699,
                        @"[In Property Data Types] PtypInteger64 (PT_LONGLONG, PT_I8, i8, ui8) is that 8 bytes; a 64-bit integer [MS-DTYP]: LONGLONG with Property Type Value 0x0014,%x14.00.");
                }

                // If propertyId is 0x001A, it means the property is PidTagMessageClass.
                if (propertyId == 0x001A)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R351");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R351.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypString,
                        propertyType,
                        351,
                        @"[In PidTagMessageClass] Type: PtypString ([MS-OXCDATA] section 2.11.1).");

                    if (this.targetOfRop == TargetOfRop.ForDAM)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R352");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R352.
                        Site.CaptureRequirementIfAreEqual<string>(
                            "IPC.Microsoft Exchange 4.0.Deferred Action",
                            AdapterHelper.PropertyValueConvertToString(propertyValue),
                            352,
                            @"[In PidTagMessageClass] The PidTagMessageClass property ([MS-OXCMSG] section 2.2.1.3) MUST be set to ""IPC.Microsoft Exchange 4.0.Deferred Action"".");
                    }
                }

                // If propertyId is 0x6647, it means the property is PidTagDamBackPatched.
                if (propertyId == 0x6647)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2698", "The length({0}) of the propertyValue should be 1 and the value of the propertyType({1}) should be 0x000b.", propertyValue.Length, propertyType);

                    // Verify MS-OXCDATA requirement: MS-OXCDATA_R2698.
                    bool isVerifyR2698 = propertyValue.Length == 1 && propertyType == 0x000B;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR2698,
                        "MS-OXCDATA",
                        2698,
                        @"[In Property Data Types] PtypBoolean (PT_BOOLEAN. bool) is that 1 byte, restricted to 1 or 0 [MS-DTYP]: BOOLEAN with Property Type Value 0x000B, %x0B.00.");

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

                    // Verify MS-OXORULE requirement: MS-OXORULE_R353.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypBoolean,
                        propertyType,
                        353,
                        @"[In PidTagDamBackPatched property] Type: PtypBoolean ([MS-OXCDATA] section 2.11.1).");
                }

                // If propertyId is 0x6646, it means the property is PidTagDamOriginalEntryId.
                if (propertyId == 0x6646)
                {
                    if (this.targetOfRop == TargetOfRop.ForDAM)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R356");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R356.
                        Site.CaptureRequirementIfAreEqual<ushort>(
                            (ushort)PropertyType.PtypBinary,
                            propertyType,
                            356,
                            @"[In PidTagDamOriginalEntryId] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");
                    }
                    else if (this.targetOfRop == TargetOfRop.ForDEM)
                    {
                        // Add the debug information. 
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R712");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R712.
                        Site.CaptureRequirementIfAreEqual<ushort>(
                            (ushort)PropertyType.PtypBinary,
                            propertyType,
                            712,
                            @"[In PidTagDamOriginalEntryId Property] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");
                    }
                }

                // If propertyId is 0x6681, it means the property is PidTagRuleProvider.
                if (propertyId == 0x6681)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R358");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R358.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypString,
                        propertyType,
                        358,
                        @"[In PidTagRuleProvider] Type: PtypString ([MS-OXCDATA] section 2.11.1).");
                }

                // If propertyId is 0x6651, it means the property is PidTagRuleFolderEntryId.
                if (propertyId == 0x6651)
                {
                    if (this.targetOfRop == TargetOfRop.ForDAM)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R360");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R360.
                        Site.CaptureRequirementIfAreEqual<ushort>(
                            (ushort)PropertyType.PtypBinary,
                            propertyType,
                            360,
                            @"[In PidTagRuleFolderEntryId] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");
                    }
                    else if (this.targetOfRop == TargetOfRop.ForDEM)
                    {
                        // Add the debug information. 
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R714");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R714.
                        Site.CaptureRequirementIfAreEqual<ushort>(
                            (ushort)PropertyType.PtypBinary,
                            propertyType,
                            714,
                            @"[In PidTagRuleFolderEntryId Property] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");
                    }
                }

                // If propertyId is 0x6645, it means the property is PidTagClientActions.
                if (propertyId == 0x6645)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R362");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R362.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypBinary,
                        propertyType,
                        362,
                        @"[In PidTagClientActions] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");

                    if (this.targetOfRop == TargetOfRop.ForDAM)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R364");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R364.
                        // Stack has constructed the rule action buffer according to section 2.2.5.
                        // If ruleAction is not null, it means the propertyValue of PidTagClientActions can be parsed as the RuleAction format successfully,
                        // which indicates this buffer has been packed according to this requirement.
                        RuleAction ruleAction = new RuleAction();
                        ruleAction = AdapterHelper.PropertyValueConvertToRuleAction(propertyValue);

                        Site.CaptureRequirementIfIsNotNull(
                            ruleAction,
                            364,
                            @"[In PidTagClientActions] The buffer MUST be packed according to the RuleAction structure specified in section 2.2.5.");
                    }
                }

                // If propertyId is 0x6675, it means the property is PidTagRuleIds.
                if (propertyId == 0x6675)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R367");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R367.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypBinary,
                        propertyType,
                        367,
                        @"[In PidTagRuleIds] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");

                    if (this.targetOfRop == TargetOfRop.ForDAM)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R369");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R369.
                        bool isVerifyR369 = AdapterHelper.PropertyValueConvertToBinary(propertyValue).Length % 8 == 0;

                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR369,
                            369,
                            @"[In PidTagRuleIds] The length of this binary property[PidTagRuleIds] MUST be a multiple of 8 bytes.");
                    }
                }

                // If propertyId is 0x6741, it means the property is PidTagDeferredActionMessageOriginalEntryId.
                if (propertyId == 0x6741)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2704");

                    // Verify MS-OXCDATA requirement: MS-OXCDATA_R2704.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        0x00FB,
                        propertyType,
                        "MS-OXCDATA",
                        2704,
                        @"[In Property Value Types] PtypServerId (PT_SVREID) is that variable size; a 16-bit COUNT field followed by a structure specified in  section 2.11.1.4. with Property Type Value 0x00FB,%xFB.00.");

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

                    // Verify MS-OXORULE requirement: MS-OXORULE_R370.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypServerId,
                        propertyType,
                        370,
                        @"[In PidTagDeferredActionMessageOriginalEntryId Property] Type: PtypServerId ([MS-OXCDATA] section 2.11.1).");
                }

                // propertyID of PidTagHasDeferredActionMessages is 0x3FEA.
                if (propertyId == 0x3FEA)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R722, the propertyType of the PidTagHasDeferredActionMessages is {0}", propertyType);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R722.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypBoolean,
                        propertyType,
                        722,
                        @"[In PidTagHasDeferredActionMessages Property] Type: PtypBoolean ([MS-OXCDATA] section 2.11.1).");
                }

                // propertyID of PidTagRwRulesStream is 0x6802.
                if (propertyId == 0x6802)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R1010, the propertyType of the PidTagRwRulesStream is {0}", propertyType);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R1010.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)PropertyType.PtypBoolean,
                        propertyType,
                        1010,
                        @"[PidTagRwRulesStream Property] Type: PtypBinary ([MS-OXCDATA] section 2.11.1).");
                }
            }
        }