public void MSOXORULE_S03_TC08_OOFBehaviorsNotExecuteOOFReplyRuleForOOFReplySuppressMessage()
{
this.CheckMAPIHTTPTransportSupported();
#region Prepare value for ruleProperties variable.
RuleProperties ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameOOFReply);
#endregion
#region Create one reply template for OP_OOF_REPLY action Type in TestUser1's Inbox folder.
ulong replyTemplateMessageID;
uint replyTemplateMessageHandle;
TaggedPropertyValue[] addReplyBody = new TaggedPropertyValue[1];
addReplyBody[0] = new TaggedPropertyValue();
PropertyTag addReplyBodyPropertyTag = new PropertyTag
{
PropertyId = (ushort)PropertyId.PidTagBody,
PropertyType = (ushort)PropertyType.PtypString
};
addReplyBody[0].PropertyTag = addReplyBodyPropertyTag;
string replyMessageBody = Common.GenerateResourceName(this.Site, Constants.MessageOfOOFReply);
addReplyBody[0].Value = Encoding.Unicode.GetBytes(replyMessageBody + "\0");
string replyTemplateSubject = Common.GenerateResourceName(this.Site, Constants.ReplyTemplateSubject);
byte[] replyTemplateGUID = this.OxoruleAdapter.CreateReplyTemplate(this.InboxFolderHandle, this.InboxFolderID, true, replyTemplateSubject, addReplyBody, out replyTemplateMessageID, out replyTemplateMessageHandle);
#endregion
#region TestUser1 adds OP_OOF_REPLY rule with PidTagRuleState set to ST_ENABLED.
ReplyActionData replyRuleActionData = new ReplyActionData
{
ReplyTemplateGUID = replyTemplateGUID,
ReplyTemplateFID = this.InboxFolderID,
ReplyTemplateMID = replyTemplateMessageID
};
RuleData ruleDataForReplyRule = AdapterHelper.GenerateValidRuleDataWithFlavor(ActionType.OP_OOF_REPLY, 1, RuleState.ST_ENABLED, replyRuleActionData, 0x00000000, ruleProperties);
RopModifyRulesResponse ropModifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleDataForReplyRule });
Site.Assert.AreEqual<uint>(0, ropModifyRulesResponse.ReturnValue, "Adding reply rule should succeed.");
#endregion
#region TestUser2 deliver a message by ROPs to TestUser1 to trigger these rules, and PidTagAutoResponseSuppress on the message has the 0x00000010 bit set.
// Let Testuser2 logon to the server
this.LogonMailbox(TestUser.TestUser2);
TaggedPropertyValue[] mailProperty = new TaggedPropertyValue[1];
mailProperty[0] = new TaggedPropertyValue();
PropertyTag mailPropertyPropertyTag = new PropertyTag
{
PropertyId = (ushort)PropertyId.PidTagAutoResponseSuppress,
PropertyType = (ushort)PropertyType.PtypInteger32
};
mailProperty[0].PropertyTag = mailPropertyPropertyTag;
mailProperty[0].Value = BitConverter.GetBytes(0x00000010);
string mailSubject = Common.GenerateResourceName(this.Site, ruleProperties.ConditionSubjectName + "Title");
uint submitMsgReturnValue = this.DeliverMessageToTriggerRule(this.User1Name, this.User1ESSDN, mailSubject, mailProperty);
Site.Assert.AreEqual(0, (int)submitMsgReturnValue, "Delivering message should succeed.");
#endregion
#region TestUser1 gets the message sent by TestUser2.
// TestUser1 log on to the server.
this.LogonMailbox(TestUser.TestUser1);
uint inboxFolderContentsTableHandle = 0;
PropertyTag[] propertyTags = new PropertyTag[1];
propertyTags[0].PropertyId = (ushort)PropertyId.PidTagSubject;
propertyTags[0].PropertyType = (ushort)PropertyType.PtypString;
uint rowCount = 0;
RopQueryRowsResponse getInboxMailMessageContent = this.GetExpectedMessage(this.InboxFolderHandle, ref inboxFolderContentsTableHandle, propertyTags, ref rowCount, 1, mailSubject);
Site.Assert.AreEqual<uint>(0, getInboxMailMessageContent.ReturnValue, "Getting the message should succeed.");
#endregion
#region TestUser2 verifies whether can receive the OOF replied message.
// TestUser2 log on to the server.
this.LogonMailbox(TestUser.TestUser2);
PropertyTag[] propertyTagList = new PropertyTag[2];
propertyTagList[0].PropertyId = (ushort)PropertyId.PidTagBody;
propertyTagList[0].PropertyType = (ushort)PropertyType.PtypString;
propertyTagList[1].PropertyId = (ushort)PropertyId.PidTagSubject;
propertyTagList[1].PropertyType = (ushort)PropertyType.PtypString;
uint contentsTableHandle = 0;
bool doesUnexpectedMessageExist = this.CheckUnexpectedMessageExist(this.InboxFolderHandle, ref contentsTableHandle, propertyTagList, replyMessageBody, PropertyId.PidTagBody);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R533");
// Verify MS-OXORULE requirement: MS-OXORULE_R533
// TestUser2 has sent a message to TestUser1. If TestUser2 doesn't get the replied message, it means the rule is not executed. This requirement can be verified.
Site.CaptureRequirementIfIsFalse(
doesUnexpectedMessageExist,
533,
@"[In Processing Incoming Messages to a Folder] [Following is a description of what the server does when it executes each action (2) type, as specified in section 2.2.5.1.1, for an incoming message] ""OP_OOF_REPLY"": The server MUST NOT send a reply if the PidTagAutoResponseSuppress property on the message has the 0x00000010 bit set.");
#endregion
}