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

VerifyRopGetPropertiesAllForDEM() private method

Verify the Properties in the DEM.
private VerifyRopGetPropertiesAllForDEM ( RopGetPropertiesAllResponse ropGetPropertiesAllResponse ) : void
ropGetPropertiesAllResponse Microsoft.Protocols.TestSuites.Common.RopGetPropertiesAllResponse The response of the RopGetProperties call.
return void
        private void VerifyRopGetPropertiesAllForDEM(RopGetPropertiesAllResponse ropGetPropertiesAllResponse)
        {
            // Used to verify R811.
            ushort verifiedPropertiesCount = 0;

            // ropGetPropertiesAllResponse.PropertyValues contains a list of properties set on a Message.
            for (int i = 0; i < ropGetPropertiesAllResponse.PropertyValues.Length; i++)
            {
                // propertyId indicates the Id of a property.
                ushort propertyId = ropGetPropertiesAllResponse.PropertyValues[i].PropertyTag.PropertyId;

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

                // propertyValue indicates the value of a property.
                byte[] propertyValue = ropGetPropertiesAllResponse.PropertyValues[i].Value;

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

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

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

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

                        if (propertyValue != null)
                        {
                            // This property value was set.
                            verifiedPropertiesCount++;
                        }

                        break;

                    // If propertyId is 0x6648, it means the property is PidTagRuleError.
                    case 0x6648:
                        {
                            // Add the debug information. 
                            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R747");

                            // Verify MS-OXORULE requirement: MS-OXORULE_R747.
                            Site.CaptureRequirementIfAreEqual<ushort>(
                                (ushort)PropertyType.PtypInteger32,
                                propertyType,
                                747,
                                @"[In PidTagRuleError Property] Type: PtypInteger32 ([MS-OXCDATA] section 2.11.1).");

                            uint ruleErrorValue = AdapterHelper.PropertyValueConvertToUint(propertyValue);

                            // Add the debug information. 
                            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R748: the value of the PidTagRuleError property is {0}", ruleErrorValue);

                            // Verify MS-OXORULE requirement: MS-OXORULE_R748.
                            // The valid error numbers are from 1 to 14, so if the ruleErrorValue is less than 15 means the ruleErrorValue is among the valid error numbers.
                            bool isVerifyR748 = ruleErrorValue > 0 && ruleErrorValue < 15;

                            Site.CaptureRequirementIfIsTrue(
                                isVerifyR748,
                                748,
                                @"[In PidTagRuleError Property] The PidTagRuleError property ([MS-OXPROPS] section 2.938) MUST be set to one of the following values [0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000a, 0x0000000b, 0x0000000c, 0x0000000d, and 0x0000000e], indicating the cause of the error encountered during the execution of the rule (2).");

                            if (propertyValue != null)
                            {
                                // This property value was set.
                                verifiedPropertiesCount++;
                            }
                        }

                        break;

                    // If propertyId is 0x6649, it means the property is PidTagRuleActionType.
                    case 0x6649:
                        {
                            // Add the debug information. 
                            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R749");

                            // Verify MS-OXORULE requirement: MS-OXORULE_R749.
                            Site.CaptureRequirementIfAreEqual<ushort>(
                                (ushort)PropertyType.PtypInteger32,
                                propertyType,
                                749,
                                @"[In PidTagRuleActionType Property] Type: PtypInteger32 ([MS-OXCDATA] section 2.11.1).");

                            if (propertyValue != null)
                            {
                                // This property value was set.
                                verifiedPropertiesCount++;
                            }
                        }

                        break;

                    // If propertyId is 0x6650, it means the property is PidTagRuleActionNumber.
                    case 0x6650:
                        {
                            // Add the debug information. 
                            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R706");

                            // Verify MS-OXORULE requirement: MS-OXORULE_R706.
                            Site.CaptureRequirementIfAreEqual<ushort>(
                                (ushort)PropertyType.PtypInteger32,
                                propertyType,
                                706,
                                @"[In PidTagRuleActionNumber Property] Type: PtypInteger32 ([MS-OXCDATA] section 2.11.1).");

                            if (propertyValue != null)
                            {
                                // This property value was set.
                                verifiedPropertiesCount++;
                            }
                        }

                        break;

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

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

                            if (propertyValue != null)
                            {
                                // This property value was set.
                                verifiedPropertiesCount++;
                            }
                        }

                        break;

                    // If propertyId is 0x6674, it means the property is PidTagRuleId.
                    case 0x6674:
                        {
                            // Add the debug information. 
                            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R716");

                            // Verify MS-OXORULE requirement: MS-OXORULE_R716.
                            Site.CaptureRequirementIfAreEqual<ushort>(
                                (ushort)PropertyType.PtypInteger64,
                                propertyType,
                                716,
                                @"[In PidTagRuleId Property] Type: PtypInteger64 ([MS-OXCDATA] section 2.11.1).");

                            if (propertyValue != null)
                            {
                                // This property value was set.
                                verifiedPropertiesCount++;
                            }
                        }

                        break;
                }
            }

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

            // Verify MS-OXORULE requirement: MS-OXORULE_R811.
            // There are 8 properties specified in section 2.2.7,
            // but the PidTagDamOriginalEntryId property and the PidTagRuleFolderEntryId property cannot get in RopGetProperteisAll ROP,
            // so currently there are 6 properties verified in this ROP, others will be verified in VerifyPropertiesInTable function.
            Site.CaptureRequirementIfAreEqual<ushort>(
                6,
                verifiedPropertiesCount,
                811,
                @"[In Handling Errors During Rule Processing] The server MUST generate the DEM in the following manner: 2. Set the property values on the DEM as specified in section 2.2.7.");
        }