Microsoft.Protocols.TestSuites.MS_OXCROPS.S03_TableROPs.MSOXCROPS_S03_TC05_TestRopFreeBookmark C# (CSharp) Method

MSOXCROPS_S03_TC05_TestRopFreeBookmark() private method

private MSOXCROPS_S03_TC05_TestRopFreeBookmark ( ) : void
return void
        public void MSOXCROPS_S03_TC05_TestRopFreeBookmark()
        {
            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: Prepare Table object, which will be used in the following ROPs.
            #region PrepareTable

            ulong folderID;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to call CreateFolder method to open a folder and create a subfolder.");

            // Call CreateFolder 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 2: 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 3: 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);

            #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 4: 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;

            // Set RopId to 0x1B, which specifies the type of ROP is RopCreateBookmark.
            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 5: 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 RopFreeBookmark request to the server and verify the success response.
            #region RopFreeBookmark

            RopFreeBookmarkRequest freeBookmarkRequest;
            RopFreeBookmarkResponse freeBookmarkResponse;

            freeBookmarkRequest.RopId = (byte)RopId.RopFreeBookmark;
            freeBookmarkRequest.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.
            freeBookmarkRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;

            freeBookmarkRequest.BookmarkSize = (ushort)userDefinedBookmark.Length;
            freeBookmarkRequest.Bookmark = userDefinedBookmark;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 6: Begin to send the RopFreeBookmark request.");

            // Send the RopFreeBookmark request to the server and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                freeBookmarkRequest,
                tableHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            freeBookmarkResponse = (RopFreeBookmarkResponse)response;

            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                freeBookmarkResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");

            #endregion
        }