public void MSOXCROPS_S02_TC01_TestOpen_Create_MoveAndDeleteFolder()
{
this.CheckTransportIsSupported();
// Step 1: Send a RopOpenFolder request to the server and verify the success response.
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));
// Log on to the private mailbox.
RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);
#region RopOpenFolder Success Response
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 0x01, 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 6th of logonResponse. This folder will be opened.
openFolderRequest.FolderId = logonResponse.FolderIds[5];
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 to the server 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)");
// Get the folder handle. This handle will be used as input handle in RopCreateFolder
// also as a source folder handle in RopMoveFolder.
uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];
#endregion
if (openFolderResponse.IsGhosted == 0x00)
{
#region Verify R561, R565 and R569
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R561");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R561
// If ServerCount is null mean not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
openFolderResponse.ServerCount,
561,
@"[In RopOpenFolder ROP Success Response Buffer] ServerCount (2 bytes): This field is not present if IsGhosted is zero.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R565");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R565
// If CheapServerCount is null mean not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
openFolderResponse.CheapServerCount,
565,
@"[In RopOpenFolder ROP Success Response Buffer] CheapServerCount (2 bytes): This field is not present if IsGhosted is zero.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R569");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R569
// If the Servers field in openFolderResponse is null, it means this field is not present.
Site.CaptureRequirementIfIsNull(
openFolderResponse.Servers,
569,
@"[In RopOpenFolder ROP Success Response Buffer] Servers (variable): This field is not present if IsGhosted is zero.");
#endregion
}
else
{
#region Verify R560, R564 and R568
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R560");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R560
// If ServerCount is not null mean present.
Site.CaptureRequirementIfIsNotNull(
openFolderResponse.ServerCount,
560,
@"[In RopOpenFolder ROP Success Response Buffer] ServerCount (2 bytes): This field is present if IsGhosted is nonzero.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R564");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R564
// If CheapServerCount is not null mean present.
Site.CaptureRequirementIfIsNotNull(
openFolderResponse.CheapServerCount,
564,
@"[In RopOpenFolder ROP Success Response Buffer] CheapServerCount (2 bytes): This field is present if IsGhosted is nonzero.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R568");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R568
// If the Servers field in openFolderResponse is not null, it means the field is present.
Site.CaptureRequirementIfIsNotNull(
openFolderResponse.Servers,
568,
@"[In RopOpenFolder ROP Success Response Buffer] Servers (variable): This field is present if IsGhosted is nonzero.");
#endregion
}
// Step 2: Create a subfolder under the opened folder and verify the success response.
#region RopCreateFolder Success Response
RopCreateFolderRequest createFolderRequest;
RopCreateFolderResponse createFolderResponse;
createFolderRequest.RopId = (byte)RopId.RopCreateFolder;
createFolderRequest.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.
createFolderRequest.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.
createFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
createFolderRequest.FolderType = (byte)FolderType.Genericfolder;
// Set UseUnicodeStrings to 0x0(FALSE), which specifies the DisplayName and Comment are not specified in Unicode.
createFolderRequest.UseUnicodeStrings = Convert.ToByte(TestSuiteBase.Zero);
// Set OpenExisting to 0xFF, which means the folder being created will be opened when it is already existed.
createFolderRequest.OpenExisting = TestSuiteBase.NonZero;
// Set Reserved to 0x0. This field is reserved and MUST be set to 0.
createFolderRequest.Reserved = TestSuiteBase.Reserved;
// Set DisplayName, which specifies the name of the created folder.
createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0");
// Set Comment, which specifies the folder comment that is associated with the created folder.
createFolderRequest.Comment = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopCreateFolder request.");
// Send the RopCreateFolder request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createFolderRequest,
openedFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
createFolderResponse = (RopCreateFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createFolderResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0(success)");
// Get the folder id of created folder, which will be used in the following RopMoveFolder.
ulong targetFolderId = createFolderResponse.FolderId;
#endregion
#region Verify R627, R631, R635, R639, R642, R643, R644, R4613 and R4614
if (createFolderResponse.IsExistingFolder == Convert.ToByte(TestSuiteBase.Zero))
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4613");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R4613
// HasRules is null means not present.
Site.CaptureRequirementIfAreEqual<byte?>(
null,
createFolderResponse.HasRules,
4613,
@"[In RopCreateFolder ROP Success Response Buffer] HasRules (1 byte): otherwise[if the IsExistingFolder field is zero], it[HasRules (1 byte)] is not present.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R627");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R627
// IsGhosted is null means not present.
Site.CaptureRequirementIfAreEqual<byte?>(
null,
createFolderResponse.IsGhosted,
627,
@"[In RopCreateFolder ROP Success Response Buffer] IsGhosted (1 byte): This field is not present otherwise[if the value of the IsExistingFolder field is zero].");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R631");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R631
// ServerCount is null means not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
createFolderResponse.ServerCount,
631,
@"[In RopCreateFolder ROP Success Response Buffer] ServerCount (2 bytes): This field is not present otherwise[if IsExistingFolder is zero].");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R635");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R635
// CheapServerCount is null means not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
createFolderResponse.CheapServerCount,
635,
@"[In RopCreateFolder ROP Success Response Buffer] CheapServerCount (2 bytes): This field is not present otherwise[if IsExistingFolder is zero].");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R639");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R639
// Servers is null means not present.
Site.CaptureRequirementIfIsNull(
createFolderResponse.Servers,
639,
@"[In RopCreateFolder ROP Success Response Buffer] Servers (variable): This field is not present otherwise[if IsExistingFolder is zero].");
}
// This bit is set for logon to a private mailbox and is not set for logon to public folders.
if (createFolderResponse.IsGhosted == null || createFolderResponse.IsGhosted == 0)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R642");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R642
// ServerCount is null means not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
createFolderResponse.ServerCount,
642,
@"[In RopCreateFolder ROP Success Response Buffer] ServerCount (2 bytes): This field is not present otherwise[if IsGhosted is zero].");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R643");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R643
// CheapServerCount is null means not present.
Site.CaptureRequirementIfAreEqual<ushort?>(
null,
createFolderResponse.CheapServerCount,
643,
@"[In RopCreateFolder ROP Success Response Buffer] CheapServerCount (2 bytes): This field is not present otherwise[if IsGhosted is zero].");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R644");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R644
// Servers is null means not present.
Site.CaptureRequirementIfIsNull(
createFolderResponse.Servers,
644,
@"[In RopCreateFolder ROP Success Response Buffer] Servers (variable): This field is not present otherwise[if IsGhosted is zero].");
}
#endregion
// Step 3: Open the second folder and set it as Destination folder (parent folder).
#region Open Folder
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 4th of logonResponse. This folder will be opened.
openFolderRequest.FolderId = logonResponse.FolderIds[4];
openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopOpenFolder request.");
// Send the RopOpenFolder request to the server 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 destinationParentFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];
List<uint> handleList = new List<uint>
{
// The openedFolderHandle will be used as source handle in the following RopMoveFolder.
// The destinationParentFolderHandle will be used as destination handle in the following RopMoveFolder.
openedFolderHandle, destinationParentFolderHandle
};
#endregion
// Step 4: Send a RopMoveFolder request to the server and verify the success response.
#region RopMoveFolder Success Response
// Move the created folder from Inbox to the second folder.
RopMoveFolderRequest moveFolderRequest;
RopMoveFolderResponse moveFolderResponse;
moveFolderRequest.RopId = (byte)RopId.RopMoveFolder;
moveFolderRequest.LogonId = TestSuiteBase.LogonId;
// Set SourceHandleIndex to 0x00, which specifies the location in the Server object handle table
// where the handle for the source Server object is stored.
moveFolderRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex0;
// Set DestHandleIndex to 0x01, which index specifies the location in the Server object handle table
// where the handle for the destination Server object is stored.
moveFolderRequest.DestHandleIndex = TestSuiteBase.DestHandleIndex;
// Set WantAsynchronous to 0x00(FALSE), which specifies the operation is to be executed synchronously.
moveFolderRequest.WantAsynchronous = Convert.ToByte(TestSuiteBase.Zero);
// Set UseUnicode to 0x00(FALSE), which specifies the NewFolderName field does not contain Unicode characters or multi-byte characters.
moveFolderRequest.UseUnicode = Convert.ToByte(TestSuiteBase.Zero);
moveFolderRequest.FolderId = targetFolderId;
// Set NewFolderName, which specifies the name for the new moved folder.
moveFolderRequest.NewFolderName = Encoding.ASCII.GetBytes(Common.GenerateResourceName(this.Site, "MovedToHereByTest") + "\0");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopMoveFolder request.");
// Send a RopMoveFolder request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
moveFolderRequest,
handleList,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
moveFolderResponse = (RopMoveFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
moveFolderResponse.ReturnValue,
"If ROP succeeds, the ReturnValue of its response is 0(success)");
#endregion
// Step 5: Send a RopDeleteFolder request to the server and verify the success response.
#region RopDeleteFolder Response
RopDeleteFolderRequest deleteFolderRequest;
RopDeleteFolderResponse deleteFolderResponse;
deleteFolderRequest.RopId = (byte)RopId.RopDeleteFolder;
deleteFolderRequest.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.
deleteFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
deleteFolderRequest.DeleteFolderFlags = (byte)DeleteFolderFlags.DeleteHardDelete;
// Set FolderId to targetFolderId. This folder is to be deleted.
deleteFolderRequest.FolderId = targetFolderId;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopDeleteFolder request.");
// Send a RopDeleteFolder request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
deleteFolderRequest,
destinationParentFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
deleteFolderResponse = (RopDeleteFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
deleteFolderResponse.ReturnValue,
"If ROP succeeds, ReturnValue of its response will be 0 (success)");
#endregion
// Step 6: Send a RopOpenFolder request to the server and verify the failure response.
#region RopOpenFolder Failure Response
// Set FolderId to 0x1, which does not exist and will lead to a failure response.
openFolderRequest.FolderId = TestSuiteBase.WrongFolderId;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 6: Begin to send the RopOpenFolder request.");
// Send a RopOpenFolder request to the server and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
openFolderRequest,
this.inputObjHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
openFolderResponse = (RopOpenFolderResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
openFolderResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
// Step 7: Send a RopCreateFolder request to the server and verify the failure response.
#region RopCreateFolder Failure Response
createFolderRequest.FolderType = (byte)FolderType.None;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopCreateFolder request.");
// Send a RopCreateFolder request to the server and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createFolderRequest,
openedFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
createFolderResponse = (RopCreateFolderResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createFolderResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
// Step 8: Send a RopMoveFolder request to the server and verify the failure response about Null Destination.
#region RopMoveFolder Null Destination Failure Response
// Remove the destination handle, then send the RopMoveFolder request and verify the failure response.
handleList.Remove(destinationParentFolderHandle);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 8: Begin to send the RopMoveFolder request.");
this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
moveFolderRequest,
handleList,
ref this.response,
ref this.rawData,
RopResponseType.NullDestinationFailureResponse);
moveFolderResponse = (RopMoveFolderResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
moveFolderResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
// Step 9: Send a RopRelease request to release all resources associated with the Server object.
#region RopRelease
this.response = null;
RopReleaseRequest releaseRequest;
releaseRequest.RopId = (byte)RopId.RopRelease;
releaseRequest.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.
releaseRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 9: Begin to send the RopRelease request.");
// Send a RopRelease request to release all resources associated with the Server object.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
releaseRequest,
this.inputObjHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4581");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R4581
// Response is null means RopRelease does not return response.
Site.CaptureRequirementIfIsNull(
this.response,
4581,
@"[In Processing the RopRelease ROP Request] The server MUST not return response for a RopRelease ROP request.");
#endregion
}