Microsoft.Protocols.TestSuites.MS_OXCROPS.S12_NotificationROPs.MSOXCROPS_S12_TC02_TestFailRPCForMaxPcbOut C# (CSharp) Method

MSOXCROPS_S12_TC02_TestFailRPCForMaxPcbOut() private method

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

            if (Common.IsRequirementEnabled(454509, this.Site)
                || Common.IsRequirementEnabled(20009, this.Site))
            {
                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));

                // Define data for properties
                string dataForProperties = string.Empty;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;
                dataForProperties += TestSuiteBase.DataForProperties;

                int loopCounter = (LoopCounter / Encoding.ASCII.GetBytes(dataForProperties).Length) + 1;

                #region Common operations for RopGetStreamSize,RopSetStreamSize and RopSeekStream

                // Log on to a private mailbox.
                RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Call GetCreatedMessageHandle method to create a message and get its handle.");

                // Call GetCreatedMessageHandle method to create a message and get its handle.
                uint messageHandle = GetCreatedMessageHandle(logonResponse.FolderIds[4], inputObjHandle);

                // Call GetOpenedStreamHandle method to open stream and get its handle.
                uint streamObjectHandle;

                for (int i = 0; i < loopCounter; i++)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Call GetOpenedStreamHandle method to open stream and get its handle:loop counter i={0}", i);

                    streamObjectHandle = this.GetOpenedStreamHandle(
                        messageHandle,
                        (ushort)(this.propertyDictionary[PropertyNames.UserSpecified].PropertyId + i));

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Call WriteStream method to write stream:loop counter i={0}", i);

                    // Call WriteStream method to write stream.
                    this.WriteStream(streamObjectHandle, dataForProperties);

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Call CommitStream method to commit source stream:loop counter i={0}", i);

                    // Call CommitStream method to commit source stream.
                    this.CommitStream(streamObjectHandle);

                    #region Release the stream.
                    RopReleaseRequest releaseRequest;

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

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopRelease request.");

                    // Send a RopRelease request to release all resources associated with the Server object.
                    this.responseSOHs = cropsAdapter.ProcessSingleRop(
                        releaseRequest,
                        streamObjectHandle,
                        ref this.response,
                        ref this.rawData,
                        RopResponseType.SuccessResponse);
                    #endregion
                }

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Call SaveMessage method to save message.");

                // Call SaveMessage method to save message.
                this.SaveMessage(messageHandle);

                #endregion

                #region Call RopGetPropertiesAll to make the response buffer larger than the maximum size specified in pcbOut

                RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest
                {
                    RopId = (byte)RopId.RopGetPropertiesAll,
                    LogonId = TestSuiteBase.LogonId,
                    InputHandleIndex = TestSuiteBase.InputHandleIndex0,
                    PropertySizeLimit = TestSuiteBase.PropertySizeLimit,
                    WantUnicode = (ushort)Zero
                };

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopGetPropertiesAll request.");

                // Send the RopGetPropertiesAll request and verify RPC error response.
                this.responseSOHs = cropsAdapter.ProcessSingleRopWithOptionResponseBufferSize(
                    getPropertiesAllRequest,
                    messageHandle,
                    ref this.response,
                    ref this.rawData,
                    RopResponseType.RPCError,
                    0x10);

                #endregion
            }
            else
            {
                Site.Assert.Inconclusive("This case runs only under Exchange 2010 and above, since Exchange 2007 does not support fail the RPC with 0x0000047D if the ROP output buffer is larger than the maximum size specified in request.");
            }
        }