public void MSOXCROPS_S04_TC02_TestRopGetMessageStatus()
{
this.CheckTransportIsSupported();
this.cropsAdapter.RpcConnect(
Common.GetConfigurationPropertyValue("SutComputerName", this.Site),
ConnectionType.PrivateMailboxServer,
Common.GetConfigurationPropertyValue("UserEssdn", this.Site),
Common.GetConfigurationPropertyValue("Domain", this.Site),
Common.GetConfigurationPropertyValue("AdminUserName", this.Site),
Common.GetConfigurationPropertyValue("PassWord", this.Site));
// Step 1: Preparations-Create and save message, then open the folder containing created message.
#region Create and save message, open folder containing created message
// Log on to a private mailbox.
RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);
// Create message.
RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest();
RopCreateMessageResponse createMessageResponse;
createMessageRequest.RopId = (byte)RopId.RopCreateMessage;
createMessageRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
createMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set OutputHandleIndex to 0x01, which specifies the location in the Server object handle table where the handle for the output Server object will be stored.
createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
// Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used.
createMessageRequest.CodePageId = TestSuiteBase.CodePageId;
// Set FolderId to the 5th of logonResponse(INBOX), which identifies the parent folder.
createMessageRequest.FolderId = logonResponse.FolderIds[4];
// Set AssociatedFlag to 0x00, which specified this message is not a folder associated information (FAI) message.
createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopCreateMessage request.");
// Send the RopCreateMessage request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createMessageRequest,
this.inputObjHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
createMessageResponse = (RopCreateMessageResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createMessageResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex];
// Save message.
RopSaveChangesMessageRequest saveChangesMessageRequest;
RopSaveChangesMessageResponse saveChangesMessageResponse;
saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage;
saveChangesMessageRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set ResponseHandleIndex to 0x01, which specifies the location in the Server object handle table that is referenced
// in the response.
saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1;
saveChangesMessageRequest.SaveFlags = (byte)SaveFlags.ForceSave;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopSaveChangesMessage request.");
// Send the RopSaveChangesMessage request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
saveChangesMessageRequest,
targetMessageHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
saveChangesMessageResponse = (RopSaveChangesMessageResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
saveChangesMessageResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0 (success)");
ulong messageId = saveChangesMessageResponse.MessageId;
// Open the folder(Inbox) containing the created message.
RopOpenFolderRequest openFolderRequest;
RopOpenFolderResponse openFolderResponse;
openFolderRequest.RopId = (byte)RopId.RopOpenFolder;
openFolderRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set OutputHandleIndex to 0x1, which specifies the location in the Server object handle table where the handle
// for the output Server object will be stored.
openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
// Set FolderId to the 5th folder of the logonResponse(INBOX), which specifies the folder to be opened.
openFolderRequest.FolderId = logonResponse.FolderIds[4];
openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder request.");
// Send the RopOpenFolder request and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
openFolderRequest,
this.inputObjHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
openFolderResponse = (RopOpenFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
openFolderResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0 (success)");
uint folderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];
#endregion
// Step 2: Send the RopSetMessageStatus request and verify the success response.
#region RopSetMessageStatus success response
RopSetMessageStatusRequest setMessageStatusRequest;
RopSetMessageStatusResponse setMessageStatusResponse;
setMessageStatusRequest.RopId = (byte)RopId.RopSetMessageStatus;
setMessageStatusRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
setMessageStatusRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set MessageId to that of created message, which value identifies the message for which the status will be changed.
setMessageStatusRequest.MessageId = messageId;
setMessageStatusRequest.MessageStatusFlags = (uint)MessageStatusFlags.MsRemoteDownload;
// Set MessageStatusMask, which specifies which bits in the MessageStatusFlags field are to be changed.
setMessageStatusRequest.MessageStatusMask = TestSuiteBase.MessageStatusMask;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopSetMessageStatus request.");
// Send the RopSetMessageStatus request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
setMessageStatusRequest,
folderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
setMessageStatusResponse = (RopSetMessageStatusResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
setMessageStatusResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0 (success)");
#endregion
// Step 3: Send the RopGetMessageStatus request and verify the success response.
#region RopGetMessageStatus success response
RopGetMessageStatusRequest getMessageStatusRequest;
getMessageStatusRequest.RopId = (byte)RopId.RopGetMessageStatus;
getMessageStatusRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
getMessageStatusRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set MessageId to that of created message, which identifies the message for which the status will be returned.
getMessageStatusRequest.MessageId = messageId;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopGetMessageStatus request.");
// Send the RopGetMessageStatus request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
getMessageStatusRequest,
folderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
// The response buffers for RopGetMessageStatus are the same as those for RopSetMessageStatus.
setMessageStatusResponse = (RopSetMessageStatusResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
setMessageStatusResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0 (success)");
#endregion
// Step 4: Send the RopSetMessageStatus request and verify the failure response.
#region RopSetMessageStatus failure response
// Set InputHandleIndex to 0x01, which is an invalid index and will lead to a failure response.
setMessageStatusRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSetMessageStatus request.");
// Send the RopSetMessageStatus request and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
setMessageStatusRequest,
folderHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
setMessageStatusResponse = (RopSetMessageStatusResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
setMessageStatusResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
// Step 5: Send the RopGetMessageStatus request and verify the failure response.
#region RopGetMessageStatus failure response
// Set InputHandleIndex to 0x01, which is an invalid index and will lead to a failure response.
getMessageStatusRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
// Set MessageId to that of created message, which identifies the message for which the status will be returned.
getMessageStatusRequest.MessageId = messageId;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopGetMessageStatus request.");
// Send the RopGetMessageStatus request and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
getMessageStatusRequest,
folderHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
// The response buffers for RopGetMessageStatus are the same as those for RopSetMessageStatus
// MS-OXCROPS 2.2.5.9.2
setMessageStatusResponse = (RopSetMessageStatusResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
setMessageStatusResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
}