public void MSOXORULE_S04_TC04_AddNotSupportedRule_OnPublicFolder()
{
this.CheckMAPIHTTPTransportSupported();
#region TestUser2 logs on to the public folder.
RopOpenFolderResponse openFolderResponse;
RopLogonResponse logonResponse;
bool ret = this.OxoruleAdapter.Connect(ConnectionType.PublicFolderServer, this.User2Name, this.User2ESSDN, this.User2Password);
Site.Assert.IsTrue(ret, "connect to public folder server should be successful");
uint publicFolderLogonHandler = this.OxoruleAdapter.RopLogon(LogonType.PublicFolder, this.User2ESSDN, out logonResponse);
// Assert the client to log on to the public folder successfully.
Site.Assert.AreEqual<uint>(0, logonResponse.ReturnValue, "Logon the public folder should be successful.");
// Folder index 1 is the Interpersonal Messages subtree, and this is defined in MS-OXCSTOR.
uint publicfolderHandler = this.OxoruleAdapter.RopOpenFolder(publicFolderLogonHandler, logonResponse.FolderIds[1], out openFolderResponse);
ulong publicFolderID = logonResponse.FolderIds[1];
#endregion
#region TestUser2 tests the unsupported rules in public folder.
#region TestUser2 prepares value for ruleProperties variable.
RuleProperties ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameDeferredAction);
#endregion
#region TestUser2 adds a Rule set Action Type to OP_DEFER_ACTION.
DeferredActionData deferredActionData = new DeferredActionData
{
Data = Common.GetBytesFromBinaryHexString(Constants.DeferredActionBufferData)
};
RuleData deferredActionRuleData = AdapterHelper.GenerateValidRuleData(ActionType.OP_DEFER_ACTION, TestRuleDataType.ForAdd, 5, RuleState.ST_ENABLED, deferredActionData, ruleProperties, null);
RopModifyRulesResponse ropModifyRulesResponse = this.OxoruleAdapter.RopModifyRules(publicfolderHandler, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { deferredActionRuleData });
#endregion
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R258: server returned value is {0}", ropModifyRulesResponse.ReturnValue);
// Verify MS-OXORULE requirement: MS-OXORULE_R258.
// If the ReturnValue is not 0x00000000, it means the server failed to add a public folder rule with this OP_DEFER_ACTION Type action.
// So it is not used in a public folder rule.
bool isVerifyR258 = ropModifyRulesResponse.ReturnValue != 0x00000000;
Site.CaptureRequirementIfIsTrue(
isVerifyR258,
258,
@"[In ActionBlock Structure] The meaning of action type OP_DEFER_ACTION: MUST NOT be used in a public folder rule (2).");
#region TestUser2 prepares rules' data.
MoveCopyActionData moveCopyActionData = new MoveCopyActionData();
// Get the Inbox folder entry ID.
byte[] folderEId = this.OxoruleAdapter.GetFolderEntryId(StoreObjectType.PublicFolder, publicfolderHandler, publicFolderID);
// Get the store object's entry ID.
byte[] storeEId = this.GetStoreObjectEntryID(StoreObjectType.PublicFolder, this.Server, this.User1ESSDN);
moveCopyActionData.FolderEID = folderEId;
moveCopyActionData.StoreEID = storeEId;
moveCopyActionData.FolderEIDSize = (ushort)folderEId.Length;
moveCopyActionData.StoreEIDSize = (ushort)storeEId.Length;
#endregion
#region TestUser2 prepares value for ruleProperties variable.
ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameMoveOne);
#endregion
#region TestUser2 adds OP_MOVE rule to the public folder.
ruleProperties.Name = Common.GenerateResourceName(this.Site, Constants.RuleNameMoveOne);
RuleData ruleForMove = AdapterHelper.GenerateValidRuleData(ActionType.OP_MOVE, TestRuleDataType.ForAdd, 0, RuleState.ST_ENABLED, moveCopyActionData, ruleProperties, null);
RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(publicfolderHandler, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleForMove });
#endregion
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R839: server returned value is {0}", modifyRulesResponse.ReturnValue);
// Verify MS-OXORULE requirement: MS-OXORULE_R839.
// If the returnValue is not 0x00000000, it means this OP_MOVE Type used in a public folder rule is failed,
// so it is not used in a public folder rule.
bool isVerifyR839 = modifyRulesResponse.ReturnValue != 0x00000000;
Site.CaptureRequirementIfIsTrue(
isVerifyR839,
839,
@"[In ActionBlock Structure] The meaning of action type OP_MOVE: MUST NOT be used in a public folder rule (2).");
#region TestUser2 adds OP_COPY rule to the public folder.
ruleProperties.Name = Common.GenerateResourceName(this.Site, Constants.RuleNameMoveTwo);
RuleData ruleForCopy = AdapterHelper.GenerateValidRuleData(ActionType.OP_COPY, TestRuleDataType.ForAdd, 1, RuleState.ST_ENABLED, moveCopyActionData, ruleProperties, null);
modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(publicfolderHandler, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleForCopy });
#endregion
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R840: server returned value is {0}", modifyRulesResponse.ReturnValue);
// Verify MS-OXORULE requirement: MS-OXORULE_R840.
// If the ReturnValue is not 0x00000000, it means this OP_COPY Type used in a public folder rule is failed,
// so it is not used in a public folder rule.
bool isVerifyR840 = modifyRulesResponse.ReturnValue != 0x00000000;
Site.CaptureRequirementIfIsTrue(
isVerifyR840,
840,
@"[In ActionBlock Structure] The meaning of action type OP_COPY: MUST NOT be used in a public folder rule (2).");
#endregion
}
}