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

VerifyExtendRuleAction() private method

Verify RuleAction buffer for extend rule.
private VerifyExtendRuleAction ( RuleAction ruleAction ) : void
ruleAction RuleAction RuleAction structure to be verified.
return void
        private void VerifyExtendRuleAction(RuleAction ruleAction)
        {
            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R945: the size of the NoOfActions field is {0} bytes", (uint)ruleAction.NoOfActions);

            // Verify MS-OXORULE requirement: MS-OXORULE_R945.
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ruleAction.NoOfActions.GetType(),
                945,
                @"[In RuleAction Structure] For extended rules, the size of the NoOfActions field is 4 bytes instead of 2 bytes.");

            for (int i = 0; i < ruleAction.Actions.Length; i++)
            {
                ActionBlock actionBlock = ruleAction.Actions[i];

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R949: the size of the ActionLength field is {0} bytes", (uint)actionBlock.ActionLength);

                // Verify MS-OXORULE requirement: MS-OXORULE_R949.
                Site.CaptureRequirementIfAreEqual<Type>(
                    typeof(uint),
                    actionBlock.ActionLength.GetType(),
                    949,
                    @"[In ActionBlock Structure] ActionLength (2 bytes): For extended rules, the size of the ActionLength field is 4 bytes instead of 2 bytes.");

                if ((actionBlock.ActionType == ActionType.OP_MOVE) || (actionBlock.ActionType == ActionType.OP_COPY))
                {
                    MoveCopyActionDataOfExtendedRule actionData = (MoveCopyActionDataOfExtendedRule)actionBlock.ActionDataValue;

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

                    // Verify MS-OXORULE_R970.
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)actionData.StoreEID.Length,
                        actionData.StoreEIDSize,
                        970,
                        @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Extended Rules] StoreEIDSize (4 bytes): An integer that specifies the size, in bytes, of the StoreEID field.");

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

                    // Verify MS-OXORULE_R975.
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)actionData.FolderEID.Length,
                        actionData.FolderEIDSize,
                        975,
                        @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Extended Rules] FolderEIDSize (4 bytes): An integer that specifies the size, in bytes, of the FolderEID field.");

                    if (actionBlock.ActionType == ActionType.OP_COPY)
                    {
                        bool isVerifyR967 = actionData.FolderEID.Length != 0 && actionData.StoreEID.Length != 0;

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

                        // Verify MS-OXORULE requirement: MS-OXORULE_R967.
                        // If StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID in the ActionData is not null, R967 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR967,
                            967,
                            @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Extended Rules] The OP_COPY ActionData structure MUST be in the following format for an extended rule.  [StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID].");
                    }

                    if (actionBlock.ActionType == ActionType.OP_MOVE)
                    {
                        bool isVerifyR966 = actionData.FolderEID.Length != 0 && actionData.StoreEID.Length != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R966, the length of FolderEID is {0}, and the length of StoreEID is {1}", actionData.FolderEID.Length, actionData.StoreEID.Length);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R966.
                        // If StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID in the ActionData is not null, R966 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR966,
                            966,
                            @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Extended Rules] The OP_MOVE ActionData structure MUST be in the following format for an extended rule.  [StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID].");
                    }
                }

                if ((actionBlock.ActionType == ActionType.OP_REPLY) || (actionBlock.ActionType == ActionType.OP_OOF_REPLY))
                {
                    ReplyActionDataOfExtendedRule actionData = (ReplyActionDataOfExtendedRule)actionBlock.ActionDataValue;

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

                    // Verify MS-OXORULE_R997.
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)actionData.ReplyTemplateMessageEID.Length,
                        actionData.MessageEIDSize,
                        997,
                        @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Extended Rules] MessageEIDSize (4 bytes): An integer that specifies the size, in bytes, of the ReplyTemplateMessageEID field.");

                    if (actionBlock.ActionType == ActionType.OP_REPLY)
                    {
                        bool isVerifyR995 = actionData.ReplyTemplateMessageEID.Length != 0 && actionData.ReplyTemplateGUID.Length != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R995, the length of ReplyTemplateMessageEID is {0}, and the actionData.ReplyTemplateGUID is {1}", (uint)actionData.ReplyTemplateMessageEID.Length, actionData.ReplyTemplateGUID.Length);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R995.
                        // If ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID in the ActionData is not null, R995 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR995,
                            995,
                            @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Extended Rules] The OP_REPLY ActionData structure MUST be in the following format for an extended rule. [MessageEIDSize, ReplyTemplateMessageEID, ReplyTemplateGUID]");
                    }

                    if (actionBlock.ActionType == ActionType.OP_OOF_REPLY)
                    {
                        bool isVerifyR996 = actionData.ReplyTemplateMessageEID.Length != 0 && actionData.ReplyTemplateGUID.Length != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R996, the length of ReplyTemplateMessageEID is {0}, and the actionData.ReplyTemplateGUID is {1}", (uint)actionData.ReplyTemplateMessageEID.Length, actionData.ReplyTemplateGUID.Length);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R996.
                        // If ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID in the ActionData is not null, R996 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR996,
                            996,
                            @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Extended Rules] The OP_OOF_REPLY ActionData structure MUST be in the following format for an extended rule. [MessageEIDSize, ReplyTemplateMessageEID, ReplyTemplateGUID]");
                    }
                }
            }
        }