public void MSOXCFOLD_S02_TC01_RopMoveCopyMessagesSuccess()
{
this.CheckWhetherSupportTransport();
this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer);
this.GenericFolderInitialization();
bool sourceMessageExist;
bool sourceMessageRemoved;
bool destinationMessageExist;
ulong[] messageIds;
List<uint> handlelist;
#region Step 1. Create a message in the root folder.
ulong messageId = 0;
uint messageHandle = 0;
this.CreateSaveMessage(this.RootFolderHandle, this.RootFolderId, ref messageId, ref messageHandle);
#endregion
#region Step 2. Call RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root folder.
ulong subfolderId1 = 0;
uint subfolderHandle1 = 0;
this.CreateFolder(this.RootFolderHandle, Constants.Subfolder1, ref subfolderId1, ref subfolderHandle1);
#endregion
#region Step 3. Call RopMoveCopyMessages to copy the message created in step 1 from the root folder to [MSOXCFOLDSubfolder1] synchronously.
messageIds = new ulong[1];
messageIds[0] = messageId;
handlelist = new List<uint>
{
this.RootFolderHandle, subfolderHandle1
};
RopMoveCopyMessagesRequest moveCopyMessagesRequest = new RopMoveCopyMessagesRequest
{
RopId = (byte)RopId.RopMoveCopyMessages,
LogonId = Constants.CommonLogonId,
SourceHandleIndex = 0x00,
DestHandleIndex = 0x01,
MessageIdCount = (ushort)messageIds.Length,
MessageIds = messageIds,
WantAsynchronous = 0x00,
WantCopy = 0xFF
};
// WantCopy is nonzero (TRUE) indicates this is a copy operation.
RopMoveCopyMessagesResponse moveCopyMessagesResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles);
Site.Assert.AreEqual<uint>(0, moveCopyMessagesResponse.ReturnValue, "The RopMoveCopyMessages ROP operation performs successfully.");
Site.Assert.AreEqual<uint>(0, moveCopyMessagesResponse.PartialCompletion, "The ROP successes for all subsets of targets");
handlelist.Clear();
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1105");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1105.
// The return value 0 of MoveCopyMessages indicates that the server responds with a RopMoveCopyMessages ROP response buffer.
Site.CaptureRequirement(
1105,
@"[In Processing a RopMoveCopyMessages ROP Request] The server responds with a RopMoveCopyMessages ROP response buffer.");
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R155");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R155.
// The WantAsynchronous was set to zero and the server responds a RopMoveCopyMessages ROP response indicates the ROP is processed synchronously, MS-OXCFOLD_R155 can be verified directly.
Site.CaptureRequirement(
155,
@"[In RopMoveCopyMessages ROP Request Buffer] WantAsynchronous (1 byte): [A Boolean value that is] zero (FALSE) if the ROP is to be processed synchronously.");
#endregion
#region Step 4. Validate the message is copied successfully in step 3.
uint rootFolderContentsCountExpect = 1;
uint rootFolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, this.RootFolderHandle);
sourceMessageExist = rootFolderContentsCountExpect == rootFolderContentsCountActual;
uint subfolderContentsCountExpect = 1;
uint subfolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, subfolderHandle1);
destinationMessageExist = subfolderContentsCountExpect == subfolderContentsCountActual;
#region Verify MS-OXCFOLD_R159, MS-OXCFOLD_R14902, MS-OXCFOLD_R15102 and MS-OXCFOLD_R14501.
// Add the debug information
Site.Log.Add(
LogEntryKind.Debug,
@"Verify MS-OXCFOLD_R159:
Expected contents count of the root folder is {0},
Actual contents count of the root folder is {1};
Expected contents count of the [MSOXCFOLDSubfolder1] is {2},
Actual contents count of the [MSOXCFOLDSubfolder1] is {3};",
rootFolderContentsCountExpect,
rootFolderContentsCountActual,
subfolderContentsCountExpect,
subfolderContentsCountActual);
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R159.
bool isVerifyR159 = sourceMessageExist && destinationMessageExist;
Site.CaptureRequirementIfIsTrue(
isVerifyR159,
159,
@"[In RopMoveCopyMessages ROP Request Buffer] WantCopy (1 byte): A Boolean value that is nonzero (TRUE) if this [RopMoveCopyMessages ROP] is a copy operation.");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R14902.
bool isVerifyR14902 = sourceMessageExist && destinationMessageExist;
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R14902: expected contents count of the root folder is {0}, actual contents count of the root folder is {1}; expected contents count of the [MSOXCFOLDSubfolder1] is {2}, actual contents count of the [MSOXCFOLDSubfolder1] is {3};", rootFolderContentsCountExpect, rootFolderContentsCountActual, subfolderContentsCountExpect, subfolderContentsCountActual);
// The source handle lists contain RootFolderHandle and subfolderHandle1, and the sourceHandleIndex is 0 and the destHandleIndex is 1 in the moveCopyMessage request, so if the message was copied successfully from root folder to the subfolder1, R14902 can be verified.
Site.CaptureRequirementIfIsTrue(
isVerifyR14902,
14902,
@"[In RopMoveCopyMessages ROP Request Buffer] SourceHandleIndex (1 byte): The source Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder from which the messages will be copied.");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R15102.
bool isVerifyR15102 = sourceMessageExist && destinationMessageExist;
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R15102: expected contents count of the root folder is {0}, actual contents count of the root folder is {1}; expected contents count of the [MSOXCFOLDSubfolder1] is {2}, actual contents count of the [MSOXCFOLDSubfolder1] is {3};", rootFolderContentsCountExpect, rootFolderContentsCountActual, subfolderContentsCountExpect, subfolderContentsCountActual);
// The source handle lists contain RootFolderHandle and subfolderHandle1, and the sourceHandleIndex is 0 and the destHandleIndex is 1 in the moveCopyMessage request, so if the message was copied successfully from root folder to the subfolder1, R15102 can be verified.
Site.CaptureRequirementIfIsTrue(
isVerifyR15102,
15102,
@"[In RopMoveCopyMessages ROP Request Buffer] DestHandleIndex (1 byte): The destination Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder to which the messages will be copied.");
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R14501");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R14501.
// MS-OXCFOLD_R159 is verified and this scenario use private mailbox logon, MS-OXCFOLD_R14501 can be verified directly.
Site.CaptureRequirement(
14501,
@"[In RopMoveCopyMessages ROP] This ROP applies to [both public folders and] private mailboxes.");
#endregion
#endregion
#region Step 5. Call RopMoveCopyMessages to move the message created in step 1 from the root folder to [MSOXCFOLDSubfolder1] synchronously.
messageIds = new ulong[] { messageId };
handlelist = new List<uint>
{
this.RootFolderHandle, subfolderHandle1
};
moveCopyMessagesRequest = new RopMoveCopyMessagesRequest();
moveCopyMessagesRequest.RopId = (byte)RopId.RopMoveCopyMessages;
moveCopyMessagesRequest.LogonId = Constants.CommonLogonId;
moveCopyMessagesRequest.SourceHandleIndex = 0x00;
moveCopyMessagesRequest.DestHandleIndex = 0x01;
moveCopyMessagesRequest.MessageIdCount = (ushort)messageIds.Length;
moveCopyMessagesRequest.MessageIds = messageIds;
moveCopyMessagesRequest.WantAsynchronous = 0x00;
// WantCopy is zero (FALSE) indicates this is a move operation.
moveCopyMessagesRequest.WantCopy = 0x00;
moveCopyMessagesResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles);
Site.Assert.AreEqual<uint>(0, moveCopyMessagesResponse.ReturnValue, "The RopMoveCopyMessages ROP operation performs successfully.");
handlelist.Clear();
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R163");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R163.
// According to the test case designing and open specification, the RopMoveCopyMessagesResponse operation here does not fail for a subset of targets, MS-OXCFOLD_R163 can be captured.
Site.CaptureRequirementIfAreEqual<byte>(
0x00,
moveCopyMessagesResponse.PartialCompletion,
163,
@"[In RopMoveCopyMessages ROP Response Buffer]PartialCompletion (1 byte): Otherwise [if the ROP successes for a subset of targets], the value is zero (FALSE).");
#endregion
#region Step 6. Validate the message is moved successfully in step 5.
rootFolderContentsCountExpect = 0;
rootFolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, this.RootFolderHandle);
sourceMessageRemoved = rootFolderContentsCountExpect == rootFolderContentsCountActual;
subfolderContentsCountExpect = 2;
subfolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, subfolderHandle1);
destinationMessageExist = subfolderContentsCountExpect == subfolderContentsCountActual;
#region Verify MS-OXCFOLD_R160, MS-OXCFOLD_R14901 and MS-OXCFOLD_R15101.
// Add the debug information
Site.Log.Add(
LogEntryKind.Debug,
@"Verify MS-OXCFOLD_R160: The validation result of whether the source message was removed is {0}, the validation result of whether the destination message is existed is {1}",
sourceMessageRemoved,
destinationMessageExist);
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R160.
bool isVerifyR160 = sourceMessageRemoved && destinationMessageExist;
Site.CaptureRequirementIfIsTrue(
isVerifyR160,
160,
@"[In RopMoveCopyMessages ROP Request Buffer] WantCopy (1 byte): [A Boolean value that is] zero (FALSE) if this [RopMoveCopyMessages ROP] is a move operation.");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R14901.
bool isVerifyR14901 = sourceMessageRemoved && destinationMessageExist;
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R14901: the validation result of whether the source message was removed is {0}, the validation result of whether the destination message is existed is {1}", sourceMessageRemoved, destinationMessageExist);
// The source handle lists contain RootFolderHandle and subfolderHandle1, and the sourceHandleIndex is 0 and the destHandleIndex is 1 in the moveCopyMessage request, so if the message was moved successfully from root folder to the subfolder1, R14901 can be verified.
Site.CaptureRequirementIfIsTrue(
isVerifyR14901,
14901,
@"[In RopMoveCopyMessages ROP Request Buffer] SourceHandleIndex (1 byte): The source Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder from which the messages will be moved.");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R15101.
bool isVerifyR15101 = sourceMessageRemoved && destinationMessageExist;
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R15101: the validation result of whether the source message was removed is {0}, the validation result of whether the destination message is existed is {1}", sourceMessageRemoved, destinationMessageExist);
// The source handle lists contain RootFolderHandle and subfolderHandle1, and the sourceHandleIndex is 0 and the destHandleIndex is 1 in the moveCopyMessage request, so if the message was moved successfully from root folder to the subfolder1, R15101 can be verified.
Site.CaptureRequirement(
15101,
@"[In RopMoveCopyMessages ROP Request Buffer] DestHandleIndex (1 byte): The destination Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder to which the messages will be moved.");
#endregion
#endregion
}