Microsoft.Protocols.TestSuites.MS_OXCRPC.S01_SynchronousCall.MSOXCRPC_S01_TC09_TestFastTransferSourceGetBuffer C# (CSharp) Method

MSOXCRPC_S01_TC09_TestFastTransferSourceGetBuffer() private method

private MSOXCRPC_S01_TC09_TestFastTransferSourceGetBuffer ( ) : void
return void
        public void MSOXCRPC_S01_TC09_TestFastTransferSourceGetBuffer()
        {
            this.CheckTransport();

            #region Client connects with Server
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
                ref this.pcxh,
                TestSuiteBase.UlIcxrLinkForNoSessionLink,
                ref this.pulTimeStamp,
                null,
                this.userDN,
                ref this.pcbAuxOut,
                this.rgwClientVersion,
                out this.rgwBestVersion,
                out this.picxr);
            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            #endregion

            #region Logon to mailbox
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopLogonResponse logonResponse = (RopLogonResponse)this.response;
            Site.Assert.AreEqual<uint>(0, logonResponse.ReturnValue, "RopLogon should succeed and '0' is expected to be returned. The returned value is {0}.", logonResponse.ReturnValue);
            this.objHandle = this.responseSOHTable[TestSuiteBase.FIRST][logonResponse.OutputHandleIndex];
            #endregion

            #region RopCreateMessage
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopCreateMessage, this.objHandle, logonResponse.FolderIds[(int)FolderIds.Inbox]);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopCreateMessageResponse createMessageResponse = (RopCreateMessageResponse)this.response;
            Site.Assert.AreEqual<uint>(0, createMessageResponse.ReturnValue, "RopCreateMessage should succeed and '0' is expected to be returned. The returned value is {0}.", createMessageResponse.ReturnValue);
            uint objCreateMessageHandle = this.responseSOHTable[TestSuiteBase.FIRST][createMessageResponse.OutputHandleIndex];
            #endregion

            #region RopOpenStream
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopOpenStream, objCreateMessageHandle, TestSuiteBase.OpenModeFlags);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopOpenStreamResponse openStreamResponse = (RopOpenStreamResponse)this.response;
            Site.Assert.AreEqual<uint>(0x00000000, openStreamResponse.ReturnValue, "RopOpenStream should succeed, the ReturnValue of its response is expected to be 0(success). The actual value is {0}.", openStreamResponse.ReturnValue);
            uint objOpenStreamHandle = this.responseSOHTable[TestSuiteBase.FIRST][openStreamResponse.OutputHandleIndex];
            #endregion

            #region RopWriteStream
            RopWriteStreamResponse writeStreamResponse;
            uint count = uint.Parse(Common.GetConfigurationPropertyValue("WriteStreamCount", this.Site));
            for (int i = 0; i < count; i++)
            {
                // Parameter auxInfo is no use for RopWriteStream command, so set it to unUsedInfo.
                this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopWriteStream, objOpenStreamHandle, this.unusedInfo);
                this.pcbOut = ConstValues.ValidpcbOut;
                this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
                this.responseSOHTable = new List<List<uint>>();

                this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                    ref this.pcxh,
                    PulFlags.NoCompression | PulFlags.NoXorMagic,
                    this.rgbIn,
                    ref this.pcbOut,
                    null,
                    ref this.pcbAuxOut,
                    out this.response,
                    ref this.responseSOHTable);
                Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);

                writeStreamResponse = (RopWriteStreamResponse)this.response;
                Site.Assert.AreEqual<uint>(0x00000000, writeStreamResponse.ReturnValue, "RopWriteStream should succeed, the ReturnValue of its response is expected to be 0(success). The returned value is {0}.", writeStreamResponse.ReturnValue);
            }
            #endregion

            #region RopCommitStream
            // Parameter auxInfo is no use for RopCommitStream command, so set it to unUsedInfo.
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopCommitStream, objOpenStreamHandle, this.unusedInfo);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);
            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);

            RopCommitStreamResponse commitStreamResponse = (RopCommitStreamResponse)this.response;
            Site.Assert.AreEqual<uint>(0x00000000, commitStreamResponse.ReturnValue, "RopCommitStream should succeed, the ReturnValue of its response is expected to be 0(success). The actual value is {0}.", commitStreamResponse.ReturnValue);

            #endregion

            #region RopSaveChangesMessage
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopSaveChangesMessage, objCreateMessageHandle, logonResponse.FolderIds[(int)FolderIds.InterpersonalMessage]);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopSaveChangesMessageResponse saveChangesMessageResponse = (RopSaveChangesMessageResponse)this.response;
            Site.Assert.AreEqual<uint>(0, saveChangesMessageResponse.ReturnValue, "RopSaveChangesMessage should succeed and '0' is expected to be returned. The returned value is {0}.", saveChangesMessageResponse.ReturnValue);
            #endregion

            #region RopOpenFolder
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopOpenFolder, this.objHandle, logonResponse.FolderIds[(int)FolderIds.Inbox]);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopOpenFolderResponse openFolderResponse = (RopOpenFolderResponse)this.response;
            Site.Assert.AreEqual<uint>(0, openFolderResponse.ReturnValue, "RopOpenFolder should succeed and '0' is expected to be returned. The returned value is {0}.", openFolderResponse.ReturnValue);
            this.objHandle = this.responseSOHTable[TestSuiteBase.FIRST][openFolderResponse.OutputHandleIndex];
            #endregion

            #region RopFastTransferSourceCopyMessagesResponse
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopFastTransferSourceCopyMessages, this.objHandle, saveChangesMessageResponse.MessageId);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopFastTransferSourceCopyMessagesResponse fastTransferSourceCopyMessagesResponse = (RopFastTransferSourceCopyMessagesResponse)this.response;
            Site.Assert.AreEqual<uint>(0, fastTransferSourceCopyMessagesResponse.ReturnValue, "RopFastTransferSourceCopyMessagesResponse should succeed and '0' is expected to be returned. The returned value is {0}.", fastTransferSourceCopyMessagesResponse.ReturnValue);
            this.objHandle = this.responseSOHTable[TestSuiteBase.FIRST][fastTransferSourceCopyMessagesResponse.OutputHandleIndex];
            #endregion

            #region RopFastTransferSourceGetBuffer
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopFastTransferSourceGetBuffer, this.objHandle, ConstValues.MaximumBufferSize);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.responseSOHTable = new List<List<uint>>();
            uint payloadCount = 0;

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic | PulFlags.Chain,
                this.rgbIn,
                ref this.rgbOut,
                ref this.pcbOut,
                null,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable,
                out payloadCount,
                ref this.rgbAuxOut);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            RopFastTransferSourceGetBufferResponse fastTransferSourceGetBufferResponse = (RopFastTransferSourceGetBufferResponse)this.response;
            Site.Assert.AreEqual<uint>(0, fastTransferSourceGetBufferResponse.ReturnValue, "RopFastTransferSourceGetBuffer should succeed and '0' is expected to be returned. The returned value is {0}.", fastTransferSourceGetBufferResponse.ReturnValue);
            #endregion

            this.ServerAddAdditionalData(payloadCount);

            #region Client disconnects with Server
            this.returnValue = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            #endregion
        }