public void MSOXCFOLD_S02_TC07_RopEmptyFolderFailure()
{
this.CheckWhetherSupportTransport();
this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer);
this.GenericFolderInitialization();
#region Step 1. Calls RopEmptyfolder using a logon handle rather than a folder handle.
RopEmptyFolderRequest emptyFolderRequest = new RopEmptyFolderRequest
{
RopId = (byte)RopId.RopEmptyFolder,
LogonId = Constants.CommonLogonId,
InputHandleIndex = Constants.CommonInputHandleIndex,
WantAsynchronous = 0x00,
WantDeleteAssociated = 0xFF
};
// Using a logon object handle to refer a logon object in which case is purposed to test error code ecNotSupported [0x80040102].
RopEmptyFolderResponse emptyFolderResponse = this.Adapter.EmptyFolder(emptyFolderRequest, this.LogonHandle, ref this.responseHandles);
#region Verify MS-OXCFOLD_R624 and MS-OXCFOLD_R625.
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R624");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R624.
Site.CaptureRequirementIfAreEqual<uint>(
0x80040102,
emptyFolderResponse.ReturnValue,
624,
@"[In Processing a RopEmptyFolder ROP Request]The value of error code ecNotSupported is 0x80040102.");
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R625");
// The MS-OXCFOLD_R624 captured error code [ecNotSupported], capture this requirement directly.
Site.CaptureRequirement(
625,
@"[In Processing a RopEmptyFolder ROP Request] When the error code is ecNotSupported, it indicates that the object that this ROP [RopEmptyFolder ROP] was called on is not a Folder object.");
#endregion
#endregion
#region Step 2. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder1] under the root folder.
RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest
{
RopId = (byte)RopId.RopCreateFolder,
LogonId = Constants.CommonLogonId,
InputHandleIndex = Constants.CommonInputHandleIndex,
OutputHandleIndex = Constants.CommonOutputHandleIndex,
FolderType = (byte)FolderType.Searchfolder,
DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder),
Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder)
};
RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles);
Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!");
uint searchFolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex];
#endregion
#region Step 3. The client calls RopEmptyFolder on the search folder created in step 2.
emptyFolderResponse = this.Adapter.EmptyFolder(emptyFolderRequest, searchFolderHandle1, ref this.responseHandles);
if (Common.IsRequirementEnabled(124901, this.Site))
{
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R124901");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R124901.
// If the client attempt to empty a search folder, the server will return ecNotSupported in the ReturnValue.
Site.CaptureRequirementIfAreEqual<uint>(
0x80040102,
emptyFolderResponse.ReturnValue,
124901,
@"[In Appendix A: Product Behavior] Implementation does return ecNotSupported (0x80040102) in the ReturnValue field of the RopEmptyFolder ROP response buffer, if the client attempts to empty a search folder. (Exchange 2007 and above follow this behavior.)");
// Add the debug information.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R3012");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R3012.
// If the client attempt to empty a search folder, the server will return ecNotSupported in the ReturnValue.
// Because the error code 0x80040102 has been captured by R124901, so R3012 can be captured directly.
Site.CaptureRequirement(
3012,
@"[In Processing a RopEmptyFolder ROP Request] When the error code is ecNotSupported, it indicates that a folder that this ROP [RopEmptyFolder ROP] was called on is not allowed to be emptied.");
}
#endregion
#region Step 4. The client calls RopOpenFolder to open the root folder.
uint rootFolderHandle = 0;
this.OpenFolder(this.LogonHandle, this.DefaultFolderIds[0], ref rootFolderHandle);
#endregion
#region Step 5. The client calls RopEmptyFolder on the root folder.
emptyFolderResponse = this.Adapter.EmptyFolder(emptyFolderRequest, rootFolderHandle, ref this.responseHandles);
if (Common.IsRequirementEnabled(124801, this.Site))
{
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R124801");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R124801
this.Site.CaptureRequirementIfAreNotEqual<uint>(
0x80040102,
emptyFolderResponse.ReturnValue,
124801,
@"[In Appendix A: Product Behavior] Implementation does not return ecNotSupported when the RopEmptyFolder ROP is called on the Root folder. <18> Section 3.2.5.9: Exchange 2007 do not return ecNotSupported (0x80040102) when the RopEmptyFolder ROP ([MS-OXCROPS] section 2.2.4.9) is called on the Root folder.");
}
if (Common.IsRequirementEnabled(124802, this.Site))
{
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R124802");
// Verify MS-OXCFOLD requirement: MS-OXCFOLD_R124802
this.Site.CaptureRequirementIfAreEqual<uint>(
0x80040102,
emptyFolderResponse.ReturnValue,
124802,
@"[In Appendix A: Product Behavior] Implementation does return ecNotSupported when the RopEmptyFolder ROP is called on the Root folder. <18> Section 3.2.5.9: Update Rollup 4 for Exchange Server 2010 Service Pack 2 (SP2), Exchange 2013 and Exchange 2016 return ecNotSupported when the RopEmptyFolder ROP is called on the Root folder.");
}
#endregion
}