public void MSOXCROPS_S03_TC03_TestRopCreateAndSeekRow()
{
this.CheckTransportIsSupported();
// Step 1: Prepare Table object, which will be used in the following ROPs.
#region PrepareTable
ulong folderID;
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));
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to call CrateFolder method to open a folder and create a subfolder.");
// Call CrateFolder method to open a folder and create a subfolder.
uint folderHandle = this.CreateFolder(out folderID);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to call GetHierarchyTableHandle method to Get HierarchyTable Handle.");
// Call GetHierarchyTableHandle method to get hierarchy table handle.
uint tableHandle = this.GetHierarchyTableHandle(folderHandle);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to call CreateAndSaveMessage method to create and save a message in the created folder.");
// Call CreateAndSaveMessage method to create and save a message in the created folder.
this.CreateAndSaveMessage(folderID);
// Send the RopSetColumns request and verify the success response.
#region RopSetColumns
RopSetColumnsRequest setColumnsRequest;
RopSetColumnsResponse setColumnsResponse;
PropertyTag[] propertyTags = CreateSampleContentsTablePropertyTags();
setColumnsRequest.RopId = (byte)RopId.RopSetColumns;
setColumnsRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
setColumnsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
setColumnsRequest.SetColumnsFlags = (byte)AsynchronousFlags.None;
setColumnsRequest.PropertyTagCount = (ushort)propertyTags.Length;
setColumnsRequest.PropertyTags = propertyTags;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopSetColumns request.");
// Send the RopSetColumns request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
setColumnsRequest,
tableHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
setColumnsResponse = (RopSetColumnsResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
setColumnsResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
#endregion
#endregion
// Step 2: Send the RopCreateBookmark request to the server and verify the success response.
#region RopCreateBookmark success response
// Create user-defined bookmark.
RopCreateBookmarkRequest createBookmarkRequest;
RopCreateBookmarkResponse createBookmarkResponse;
createBookmarkRequest.RopId = (byte)RopId.RopCreateBookmark;
createBookmarkRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
createBookmarkRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopCreateBookmark request.");
// Send the RopCreateBookmark request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createBookmarkRequest,
tableHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
createBookmarkResponse = (RopCreateBookmarkResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createBookmarkResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
byte[] userDefinedBookmark = createBookmarkResponse.Bookmark;
#endregion
// Step 3: Send the RopSeekRowBookmark request to the server and verify the success response.
#region RopSeekRowBookmark success response
RopSeekRowBookmarkRequest seekRowBookmarkRequest;
seekRowBookmarkRequest.RopId = (byte)RopId.RopSeekRowBookmark;
seekRowBookmarkRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle for the input Server object is stored.
seekRowBookmarkRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set BookmarkSize, which specifies the size of the Bookmark field.
seekRowBookmarkRequest.BookmarkSize = (ushort)userDefinedBookmark.Length;
// Set Bookmark, which specifies the origin for the seek operation.
seekRowBookmarkRequest.Bookmark = userDefinedBookmark;
// Set RowCount, which specifies the direction and the number of rows to seek.
seekRowBookmarkRequest.RowCount = TestSuiteBase.RowCount;
// Set WantRowMovedCount to 0xff(TRUE), which specifies the server returns the actual number of rows sought
// in the response.
seekRowBookmarkRequest.WantRowMovedCount = TestSuiteBase.NonZero;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopSeekRowBookmark request.");
// Send the RopSeekRowBookmark request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
seekRowBookmarkRequest,
tableHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createBookmarkResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
#endregion
// Step 4: Send the RopCreateBookmark request to the server and verify the failure response.
#region RopCreateBookmark failure response
// Set InputHandleIndex to 0x01, which is an invalid index and will lead to a failure response.
createBookmarkRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopCreateBookmark request.");
// Send the RopCreateBookmark request to the server and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createBookmarkRequest,
tableHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
createBookmarkResponse = (RopCreateBookmarkResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createBookmarkResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
// Step 5: Send the RopSeekRowBookmark request to the server and verify the failure response.
#region RopSeekRowBookmark failure response
// Set InputHandleIndex to 0x01, which is an invalid index and will lead to a failure response.
seekRowBookmarkRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopSeekRowBookmark request.");
// Send the RopSeekRowBookmark request to the server and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
seekRowBookmarkRequest,
tableHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createBookmarkResponse.ReturnValue,
"If ROP fails, the ReturnValue of its response is set to a value other than 0x00000000(failure)");
#endregion
}