public void MSOXCMSG_S03_TC07_RopSetMessageReadFlagsFailure() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); #region Call RopLogon to logon the private mailbox. // Create a message RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopCreateMessage to create Message object in inbox folder. uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopSaveChangesMessage to save created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag with invalid parameters to get the failure response. RopSetMessageReadFlagRequest setMessageReadFlagRequest = new RopSetMessageReadFlagRequest() { RopId = (byte)RopId.RopSetMessageReadFlag, LogonId = CommonLogonId, ResponseHandleIndex = CommonOutputHandleIndex, // This index specifies the location in the Server object handle table that is referenced in the response. InputHandleIndex = InvalidInputHandleIndex, ReadFlags = (byte)ReadFlags.ClearReadFlag, ClientData = new byte[] { } }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, this.insideObjHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopSetMessageReadFlagResponse setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1521"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1521 this.Site.CaptureRequirementIfAreEqual<uint>( 0x000004B9, setMessageReadFlagResponse.ReturnValue, 1521, @"[In Receiving a RopSetMessageReadFlag ROP Request] [ecNullObject (0x000004B9)] The value of the InputHandleIndex field on which this ROP [RopSetMessageReadFlag] was called does not refer to a Folder object."); #endregion #region Call RopRelease to release the created message this.ReleaseRop(targetMessageHandle); #endregion }
public void MSOXCMSG_S03_TC04_RopSetMessageReadFlagsInPublicFolderMode() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PublicFolderServer); List<PropertyTag> propertyTags = new List<PropertyTag> { PropertyHelper.PropertyTagDic[PropertyNames.PidTagMessageFlags] }; List<PropertyObj> ps = new List<PropertyObj>(); #region Call RopLogon to logon the public folder. RopLogonResponse logonResponse = this.Logon(LogonType.PublicFolder, out this.insideObjHandle); #endregion #region Call RopOpenFolder to open the second folder. uint openedFolderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[1], this.insideObjHandle); #endregion #region Call RopCreateFolder to create a temporary public folder. ulong folderId = this.CreateSubFolder(openedFolderHandle); this.isCreatePulbicFolder = true; this.publicFolderID = folderId; #endregion #region Call RopOpenFolder to open the temporary public folder. this.OpenSpecificFolder(folderId, this.insideObjHandle); #endregion #region Call RopCreateMessage to create a message. uint targetMessageHandle = this.CreatedMessage(folderId, this.insideObjHandle); #endregion #region Call RopSaveChangesMessage to save the created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); this.ReleaseRop(targetMessageHandle); #endregion #region Call RopLongTermIdFromId to get the Long Term Id. RopLongTermIdFromIdRequest longTermIdFromIdRequest = new RopLongTermIdFromIdRequest() { RopId = (byte)RopId.RopLongTermIdFromId, // RopId 0x43 indicates RopLongTermIdFromId LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. ObjectId = saveChangesMessageResponse.MessageId }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(longTermIdFromIdRequest, this.insideObjHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopLongTermIdFromIdResponse longTermIdFromIdResponse = (RopLongTermIdFromIdResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, longTermIdFromIdResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopOpenMessage to open the created message. uint openMessageHandle = this.OpenSpecificMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, MessageOpenModeFlags.ReadWrite); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfDefault for the created message. RopSetMessageReadFlagRequest setMessageReadFlagRequest = new RopSetMessageReadFlagRequest() { RopId = (byte)RopId.RopSetMessageReadFlag, LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. ResponseHandleIndex = CommonOutputHandleIndex, // This index specifies the location in the Server object handle table that is referenced in the response. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. ClientData = longTermIdFromIdResponse.LongTermId.Serialize(), ReadFlags = (byte)ReadFlags.Default }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopSetMessageReadFlagResponse setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfSuppressReceipt for the created message. setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.SuppressReceipt; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfClearReadFlag for the created message. ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.ClearReadFlag; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R921, the ReadStatusChanged field value is {0}.", setMessageReadFlagResponse.ReadStatusChanged); // Verify MS-OXCMSG requirement: MS-OXCMSG_R921 bool isVerifiedR921 = setMessageReadFlagResponse.ReadStatusChanged > 0 && pidTagMessageFlagsBeforeSet.Value != pidTagMessageFlagsAfterSet.Value; this.Site.CaptureRequirementIfIsTrue( isVerifiedR921, 921, @"[In RopSetMessageReadFlag ROP Response Buffer] [ReadStatusChanged] [The value non-zero indicates that] The read status on the Message object changed and the logon is in public folder mode."); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfGenerateReceiptOnly for the created message. ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); pidTagMessageFlagsBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.GenerateReceiptOnly; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); pidTagMessageFlagsAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R920, the ReadStatusChanged field value is {0}.", setMessageReadFlagResponse.ReadStatusChanged); // Verify MS-OXCMSG requirement: MS-OXCMSG_R920 bool isVerifiedR920 = setMessageReadFlagResponse.ReadStatusChanged == 0 && Convert.ToInt32(pidTagMessageFlagsBeforeSet.Value) == Convert.ToInt32(pidTagMessageFlagsAfterSet.Value); this.Site.CaptureRequirementIfIsTrue( isVerifiedR920, 920, @"[In RopSetMessageReadFlag ROP Response Buffer] [ReadStatusChanged] [The value 0x00 indicates that] The read status on the Message object was unchanged."); #endregion #region Call RopRelease to release the created folder and message this.ReleaseRop(openMessageHandle); this.ReleaseRop(openedFolderHandle); #endregion }
public void MSOXCMSG_S03_TC05_RopSetMessageReadFlagsNotInPublicFolderMode() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); List<PropertyTag> propertyTags = new List<PropertyTag> { PropertyHelper.PropertyTagDic[PropertyNames.PidTagMessageFlags], PropertyHelper.PropertyTagDic[PropertyNames.PidTagChangeKey], PropertyHelper.PropertyTagDic[PropertyNames.PidTagLastModificationTime] }; List<PropertyObj> ps = new List<PropertyObj>(); #region Call RopLogon to logon the private mailbox. // Create a message RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopCreateMessage to create Message object in inbox folder. uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopSaveChangesMessage to save created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopOpenFolder request to open inbox folder. this.OpenSpecificFolder(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopGetPropertiesSpecific to get the PidTagMessageFlags property of created message. ps = this.GetSpecificPropertiesOfMessage(logonResponse.FolderIds[4], saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); PropertyObj pidTagChangeKeyBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagChangeKey); PropertyObj pidTagLastModificationTimeBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagLastModificationTime); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to 0x04 for the created message. RopSetMessageReadFlagRequest setMessageReadFlagRequest = new RopSetMessageReadFlagRequest() { RopId = (byte)RopId.RopSetMessageReadFlag, LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. ResponseHandleIndex = CommonOutputHandleIndex, // This index specifies the location in the Server object handle table that is referenced in the response. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. ReadFlags = (byte)ReadFlags.ClearReadFlag, ClientData = new byte[] { } }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopSetMessageReadFlagResponse setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1841"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1841 this.Site.CaptureRequirementIfAreEqual<byte>( 0x00, setMessageReadFlagResponse.ReadStatusChanged, 1841, @"[In RopSetMessageReadFlag ROP Response Buffer] [ReadStatusChanged] [The value 0x00 indicates that] the logon is not in public folder mode."); #endregion #region Call RopGetPropertiesSpecific to get the PidTagMessageFlags property of created message. ps = this.GetSpecificPropertiesOfMessage(logonResponse.FolderIds[4], saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); PropertyObj pidTagChangeKeyAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagChangeKey); PropertyObj pidTagLastModificationTimeAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagLastModificationTime); #region Verify requirements // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R835"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R835 this.Site.CaptureRequirementIfAreNotEqual<int>( (int)pidTagMessageFlagsBeforeSet.Value, (int)pidTagMessageFlagsAfterSet.Value, 835, @"[In RopSetMessageReadFlag ROP] The RopSetMessageReadFlag ROP ([MS-OXCROPS] section 2.2.6.11) changes the state of the PidTagMessageFlags property (section 2.2.1.6) for the Message object."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R537"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R537 this.Site.CaptureRequirementIfAreNotEqual<int>( (int)pidTagMessageFlagsBeforeSet.Value, (int)pidTagMessageFlagsAfterSet.Value, 537, @"[In PidTagMessageFlags Property] The PidTagMessageFlags property is also modified using the RopSetMessageReadFlag ROP ([MS-OXCROPS] section 2.2.6.11), as described in section 2.2.3.11."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1710"); bool isSameChangekey = Common.CompareByteArray((byte[])pidTagChangeKeyBeforeSet.Value, (byte[])pidTagChangeKeyAfterSet.Value); Site.Assert.IsTrue(isSameChangekey, "The PidTagChangeKey property should not be changed."); Site.Assert.AreEqual<DateTime>( Convert.ToDateTime(pidTagLastModificationTimeBeforeSet.Value), Convert.ToDateTime(pidTagLastModificationTimeAfterSet.Value), "The PidTagLastModificationTime property should not be changed."); // Because above step has verified only changes the PidTagMessageFlags property, not the PidTagChangeKey property and PidTagLastModificationTime property. // R1710 will be direct verified. this.Site.CaptureRequirement( 1710, @"[In Receiving a RopSetMessageReadFlag ROP Request] The server immediately commits the changes to the Message object as if the Message object had been opened and the RopSaveChangesMessage ROP ([MS-OXCROPS] section 2.2.6.3) had been called, except that it [server] only changes the PidTagMessageFlags property (section 2.2.1.6), not the PidTagChangeKey property ([MS-OXCFXICS] section 2.2.1.2.7), the PidTagLastModificationTime property (section 2.2.2.2), or any other property that is modified during a RopSaveChangesMessage ROP request ([MS-OXCROPS] section 2.2.6.3)."); #endregion #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfClearNotifyRead for the created message. setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.ClearNotifyRead; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfClearNotifyUnread for the created message. setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.ClearNotifyUnread; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopRelease to release the created message this.ReleaseRop(targetMessageHandle); #endregion }
/// <summary> /// Verify the property of ReadStatusChanged /// </summary> /// <param name="ropSetMessageReadFlagResponse"> A structure of RopSetMessageReadFlagResponse </param> /// <param name="ropSetMessageReadFlagRequest">Return RopSetMessageReadFlagRequest</param> private void VerifyMessageSyntaxReadStatusChanged(RopSetMessageReadFlagResponse ropSetMessageReadFlagResponse, RopSetMessageReadFlagRequest ropSetMessageReadFlagRequest) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R846"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R846 Site.CaptureRequirementIfAreEqual<int>( 1, ropSetMessageReadFlagResponse.ReadStatusChanged.ToString().Length, 846, @"[In RopSetMessageReadFlag ROP Response Buffer] ReadStatusChanged: 1 byte containing one of the following values [0x00, Nonzero]."); if (ropSetMessageReadFlagResponse.ReadStatusChanged != 0) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R848"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R848 Site.CaptureRequirementIfAreEqual<byte>( ropSetMessageReadFlagRequest.LogonId, (byte)ropSetMessageReadFlagResponse.LogonId, 848, @"[In RopSetMessageReadFlag ROP Response Buffer] LogonId: 1 byte containing the LogonID from the request when the value in the ReadStatusChanged field is nonzero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R851"); bool isR851Verified = Common.CompareByteArray(ropSetMessageReadFlagRequest.ClientData, ropSetMessageReadFlagResponse.ClientData); // Verify MS-OXCMSG requirement: MS-OXCMSG_R851 this.Site.CaptureRequirementIfIsTrue( isR851Verified, 851, @"[In RopSetMessageReadFlag ROP Response Buffer] ClientData: 24 bytes containing the ClientData field from the request when the value in the ReadStatusChanged field is nonzero."); } else { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R849"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R849 Site.CaptureRequirementIfIsNull( ropSetMessageReadFlagResponse.LogonId, 849, @"[In RopSetMessageReadFlag ROP Response Buffer] [LogonId] 0 bytes otherwise [when the value in ReadStatusChanged is zero]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R852"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R852 this.Site.CaptureRequirementIfIsNull( ropSetMessageReadFlagResponse.ClientData, 852, @"[In RopSetMessageReadFlag ROP Response Buffer] [ClientData] 0 bytes otherwise [when the value in ReadStatusChanged is zero]."); } }