Microsoft.Protocols.TestSuites.MS_OXCROPS.S01_LogonROPs.MSOXCROPS_S01_TC06_TestRopIdFromLongTermId C# (CSharp) Method

MSOXCROPS_S01_TC06_TestRopIdFromLongTermId() private method

private MSOXCROPS_S01_TC06_TestRopIdFromLongTermId ( ) : void
return void
        public void MSOXCROPS_S01_TC06_TestRopIdFromLongTermId()
        {
            this.CheckTransportIsSupported();

            // Step 1: Send a RopLongTermIdFromId request to the server and verify the success response.
            #region RopLongTermIdFromId 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));

            RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder and RopCreateFolder request to get the created folder Id.");

            // Create a folder and get its folder id, this id will be converted to a long-term ID.
            ulong objectId = this.GetCreatedsubFolderId(ref logonResponse);

            RopLongTermIdFromIdRequest longTermIdFromIdRequest;
            RopLongTermIdFromIdResponse longTermIdFromIdResponse;

            longTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId;

            longTermIdFromIdRequest.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.
            longTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;

            // Set ObjectId to that got in the foregoing code, this id will be converted to a short-term ID.
            longTermIdFromIdRequest.ObjectId = objectId;

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

            // Send the RopLongTermIdFromId request to the server and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                longTermIdFromIdRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            longTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response;

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

            #endregion

            // Step 2: Send a RopIdFromLongTermId to the server and verify the success response.
            #region RopIdFromLongTermId success response

            RopIdFromLongTermIdRequest ropIdFromLongTermIdRequest;
            RopIdFromLongTermIdResponse ropIdFromLongTermIdResponse;

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

            ropIdFromLongTermIdRequest.LongTermId.DatabaseGuid = longTermIdFromIdResponse.LongTermId.DatabaseGuid;
            ropIdFromLongTermIdRequest.LongTermId.GlobalCounter = longTermIdFromIdResponse.LongTermId.GlobalCounter;

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

            // Send the RopIdFromLongTermId request to the server and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                ropIdFromLongTermIdRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            ropIdFromLongTermIdResponse = (RopIdFromLongTermIdResponse)response;

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

            #endregion

            // Step 3: Send a RopIdFromLongTermId to request the server and verify the failure response.
            #region Failure response, verify R471201

            // Set InputHandleIndex to 0x01, which is an invalid index and will lead to a failure response.
            ropIdFromLongTermIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;

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

            // Send a RopIdFromLongTermId request to the server and verify the failure response.
            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                ropIdFromLongTermIdRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.FailureResponse);

            ropIdFromLongTermIdResponse = (RopIdFromLongTermIdResponse)response;

            if (Common.IsRequirementEnabled(471201, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R471201");

                // Verify MS-OXCROPS requirement: MS-OXCROPS_R471201
                Site.CaptureRequirementIfAreEqual<uint>(
                    TestSuiteBase.ReturnValueForRopFail,
                    ropIdFromLongTermIdResponse.ReturnValue,
                    471201,
                    @"[In Appendix B: Product Behavior] If the index is invalid, implementation does fail the ROP with the ReturnValue field set to 0x000004B9. (Microsoft Exchange Server 2010 and above follow this behavior.) ");
            }

            #endregion
        }