Microsoft.Protocols.TestSuites.MS_OXCROPS.S09_RuleROPs.MSOXCROPS_S09_TC01_TestRopModifyRules C# (CSharp) Method

MSOXCROPS_S09_TC01_TestRopModifyRules() private method

private MSOXCROPS_S09_TC01_TestRopModifyRules ( ) : void
return void
        public void MSOXCROPS_S09_TC01_TestRopModifyRules()
        {
            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: Preparations-Open folder and get it's handle.
            RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Call GetFolderObjectHandle method to get folder object handle..");

            uint folderHandle = GetFolderObjectHandle(ref logonResponse);

            // Step 2: Send the RopModifyRules request and verify success response.
            #region RopModifyRules

            RopModifyRulesRequest modifyRulesRequest;
            RopModifyRulesResponse modifyRulesResponse;
            RuleData[] sampleRuleDataArray;

            modifyRulesRequest.RopId = (byte)RopId.RopModifyRules;

            modifyRulesRequest.LogonId = TestSuiteBase.LogonId;
            modifyRulesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;

            // Call CreateSampleRuleDataArrayForAdd method to create Sample RuleData Array.
            sampleRuleDataArray = this.CreateSampleRuleDataArrayForAdd();

            modifyRulesRequest.ModifyRulesFlags = (byte)ModifyRulesFlags.None;
            modifyRulesRequest.RulesCount = (ushort)sampleRuleDataArray.Length;
            modifyRulesRequest.RulesData = sampleRuleDataArray;

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

            // Send the RopModifyRules request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                modifyRulesRequest,
                folderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            modifyRulesResponse = (RopModifyRulesResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                modifyRulesResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success0");

            #endregion

            // Step 3: Send the RopGetRulesTable request and verify success response.
            #region RopGetRulesTable

            RopGetRulesTableRequest getRulesTableRequest;
            RopGetRulesTableResponse getRulesTableResponse;

            getRulesTableRequest.RopId = (byte)RopId.RopGetRulesTable;
            getRulesTableRequest.LogonId = TestSuiteBase.LogonId;
            getRulesTableRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            getRulesTableRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            getRulesTableRequest.TableFlags = (byte)TableFlags.None;

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

            // Send the RopGetRulesTable request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                getRulesTableRequest,
                folderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            getRulesTableResponse = (RopGetRulesTableResponse)response;
            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                getRulesTableResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success0");

            #endregion

            // Step 4: Send the RopUpdateDeferredActionMessages request and verify success response.
            #region RopUpdateDeferredActionMessages

            RopUpdateDeferredActionMessagesRequest updateDeferredActionMessagesRequest;

            updateDeferredActionMessagesRequest.RopId = (byte)RopId.RopUpdateDeferredActionMessages;
            updateDeferredActionMessagesRequest.LogonId = TestSuiteBase.LogonId;
            updateDeferredActionMessagesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;

            // Set ServerEntryIdSize,which specifies the size of the ServerEntryId field.
            updateDeferredActionMessagesRequest.ServerEntryIdSize = TestSuiteBase.ServerEntryIdSize;

            byte[] serverId = { ServerEntryId };
            updateDeferredActionMessagesRequest.ServerEntryId = serverId;

            // Set ClientEntryIdSize,which specifies the size of the ClientEntryId field.
            updateDeferredActionMessagesRequest.ClientEntryIdSize = TestSuiteBase.ClientEntryIdSize;

            byte[] clientId = { ClientEntryId };
            updateDeferredActionMessagesRequest.ClientEntryId = clientId;

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

            // Send the RopUpdateDeferredActionMessages request.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                updateDeferredActionMessagesRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);

            #endregion
        }