/// <summary>
        /// Composes the RopCreateMessage Request Buffer.
        /// This ROP creates a Message object in a mailbox. More detailed information about this operation can be found in [MS-OXCMSG].
        /// </summary>
        /// <param name="inputServerObjectHandle">The handle for the input Server Object.</param>
        /// <param name="folderId">This value identifies the parent folder.</param>
        /// <returns>The rgbIn buffer generated by this method.</returns>
        public byte[] ComposeCreateMessageRequest(uint inputServerObjectHandle, ulong folderId)
        {
            RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest
            {
                RopId             = (byte)RopId.RopCreateMessage,
                LogonId           = Convert.ToByte(0),
                InputHandleIndex  = Convert.ToByte(0),
                OutputHandleIndex = Convert.ToByte(ConstValues.OutputHandleIndexForOneRop),
                CodePageId        = ConstValues.LogonCodePageId, // Code page of Logon object is used
                FolderId          = folderId,                    // Create a message in INBOX
                AssociatedFlag    = Convert.ToByte(0)            // NOT an FAI message
            };

            List <ISerializable> requestRops = new List <ISerializable>
            {
                createMessageRequest
            };
            List <uint> requestSOH = new List <uint>
            {
                // 0xFFFFFFFF is the default value for server output object handle.
                inputServerObjectHandle, ConstValues.DefaultOutputHandle
            };

            return(this.BuildRequestBuffer(requestRops, requestSOH));
        }
Esempio n. 2
0
        /// <summary>
        /// This ROP creates a Message object in a mailbox.
        /// </summary>
        /// <param name="handle">The handle to operate.</param>
        /// <param name="folderId">This value identifies the parent folder.</param>
        /// <param name="associatedFlag">This flag specifies whether the message is a folder associated information (FAI) message.</param>
        /// <param name="createMessageResponse">The response of this ROP.</param>
        /// <param name="needVerify">Whether need to verify the response</param>
        /// <returns>The handle of the created message.</returns>
        private uint RopCreateMessage(uint handle, ulong folderId, byte associatedFlag, out RopCreateMessageResponse createMessageResponse, bool needVerify)
        {
            this.rawDataValue      = null;
            this.responseValue     = null;
            this.responseSOHsValue = null;

            RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest()
            {
                RopId             = (byte)RopId.RopCreateMessage,
                LogonId           = LogonId,
                InputHandleIndex  = (byte)HandleIndex.FirstIndex,
                OutputHandleIndex = (byte)HandleIndex.SecondIndex,
                CodePageId        = (ushort)CodePageId.SameAsLogonObject,
                FolderId          = folderId,
                AssociatedFlag    = associatedFlag
            };

            this.responseSOHsValue = this.ProcessSingleRop(createMessageRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            createMessageResponse  = (RopCreateMessageResponse)this.responseValue;
            if (needVerify)
            {
                this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, createMessageResponse.ReturnValue, string.Format("RopCreateMessageResponse Failed! Error: 0x{0:X8}", createMessageResponse.ReturnValue));
            }

            return(this.responseSOHsValue[0][createMessageResponse.OutputHandleIndex]);
        }
Esempio n. 3
0
        /// <summary>
        /// Create and save message.
        /// </summary>
        /// <param name="folderHandle">Folder Handle </param>
        /// <param name="folderId">Folder Id  which messages will be create in.</param>
        /// <param name="associatedFlag">Specifies whether the message is a Folder Associated Information message.</param>
        /// <param name="messageId"> Message Id which will be returned by server.</param>
        /// <param name="messageHandle">Message Handle which will be returned by server.</param>
        protected void CreateSaveMessage(uint folderHandle, ulong folderId, byte associatedFlag, ref ulong messageId, ref uint messageHandle)
        {
            // Create a Message.
            RopCreateMessageRequest  createMessageRequest  = new RopCreateMessageRequest();
            RopCreateMessageResponse createMessageResponse = new RopCreateMessageResponse();
            object ropResponse = null;

            createMessageRequest.RopId             = (byte)RopId.RopCreateMessage;
            createMessageRequest.LogonId           = Constants.CommonLogonId;
            createMessageRequest.InputHandleIndex  = Constants.CommonInputHandleIndex;
            createMessageRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex;
            createMessageRequest.CodePageId        = 0x0FFF;
            createMessageRequest.FolderId          = folderId;
            createMessageRequest.AssociatedFlag    = associatedFlag;
            this.Adapter.DoRopCall(createMessageRequest, folderHandle, ref ropResponse, ref this.responseHandles);

            createMessageResponse = (RopCreateMessageResponse)ropResponse;
            Site.Assert.AreEqual <uint>(0, createMessageResponse.ReturnValue, "Creating Message should succeed");
            messageHandle = this.responseHandles[0][createMessageResponse.OutputHandleIndex];

            // Save a Message.
            RopSaveChangesMessageRequest  saveChangesMessageRequest  = new RopSaveChangesMessageRequest();
            RopSaveChangesMessageResponse saveChangesMessageResponse = new RopSaveChangesMessageResponse();

            saveChangesMessageRequest.RopId               = (byte)RopId.RopSaveChangesMessage;
            saveChangesMessageRequest.LogonId             = Constants.CommonLogonId;
            saveChangesMessageRequest.InputHandleIndex    = Constants.CommonInputHandleIndex;
            saveChangesMessageRequest.ResponseHandleIndex = 0x01;
            saveChangesMessageRequest.SaveFlags           = 0x0C;
            this.Adapter.DoRopCall(saveChangesMessageRequest, messageHandle, ref ropResponse, ref this.responseHandles);

            saveChangesMessageResponse = (RopSaveChangesMessageResponse)ropResponse;
            Site.Assert.AreEqual <uint>(
                0,
                createMessageResponse.ReturnValue,
                "Save Messages Success.");
            messageId = saveChangesMessageResponse.MessageId;
        }
        public void MSOXCROPS_S12_TC01_TestRopPending()
        {
            this.CheckTransportIsSupported();

            this.cropsAdapter.RpcConnect(
                Common.GetConfigurationPropertyValue("SutComputerName", this.Site),
                ConnectionType.PrivateMailboxServer,
                Common.GetConfigurationPropertyValue("UserEssdn", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                Common.GetConfigurationPropertyValue("UserName", this.Site),
                Common.GetConfigurationPropertyValue("PassWord", this.Site));

            // Step 1: Send the RopRegisterNotification request and verify the success response.
            #region RopRegisterNotification success response

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

            RopRegisterNotificationRequest  registerNotificationRequest;
            RopRegisterNotificationResponse registerNotificationResponse;

            registerNotificationRequest.RopId = (byte)RopId.RopRegisterNotification;

            registerNotificationRequest.LogonId           = TestSuiteBase.LogonId;
            registerNotificationRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            registerNotificationRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex0;

            // The server MUST send notifications to the client when CriticalError events occur within the scope of interest
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.NewMail;
            registerNotificationRequest.Reserved          = TestSuiteBase.Reserved;

            // TRUE: the scope for notifications is the entire database
            registerNotificationRequest.WantWholeStore = TestSuiteBase.NonZero;

            registerNotificationRequest.FolderId  = logonResponse.FolderIds[4];
            registerNotificationRequest.MessageId = MS_OXCROPSAdapter.MessageIdForRops;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x02.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x04, which means the server sends notifications to the client when ObjectCreated events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.ObjectCreated;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x04.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x08, which means the server sends notifications to the client when ObjectDeleted events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.ObjectDeleted;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x08.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x10, which means the server sends notifications to the client when ObjectModified events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.ObjectModified;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x10.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x20, which means the server sends notifications to the client when ObjectMoved events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.ObjectMoved;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x20.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x40, which means the server sends notifications to the client when ObjectCopied events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.ObjectCopied;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x40.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            // Set NotificationTypes to 0x80, which means the server sends notifications to the client when SearchCompleted events occur
            // within the scope of interest, as specified in [MS-OXCNOTIF].
            registerNotificationRequest.NotificationTypes = (byte)NotificationTypes.SearchCompleted;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopRegisterNotification request:NotificationTypes=0x80.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                registerNotificationRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            registerNotificationResponse = (RopRegisterNotificationResponse)response;

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

            #endregion

            // Step 2: Create message,Save message to test RopPending, RopNotify and RopBufferTooSmall
            #region RopRegisterNotification success response

            #region prepare rops for createmessage, savemessage and release
            RopCreateMessageRequest      createMessageRequest      = new RopCreateMessageRequest();
            RopSaveChangesMessageRequest saveChangesMessageRequest = new RopSaveChangesMessageRequest();
            RopReleaseRequest            releaseRequest            = new RopReleaseRequest();
            this.PrepareRops(logonResponse, ref createMessageRequest, ref saveChangesMessageRequest, ref releaseRequest);
            #endregion
            // Totally create message loop count.
            int  loopCount;
            uint tableHandle = 0;

            string transportSeq = Common.GetConfigurationPropertyValue("TransportSeq", this.Site).ToLower();
            if (transportSeq == "mapi_http")
            {
                loopCount = 20;
                this.CreateVastMessages(ref logonResponse, out tableHandle, loopCount, createMessageRequest, saveChangesMessageRequest, releaseRequest);
            }
            else
            {
                loopCount = 1000;
                this.CreateSingleProcessEachLoop(ref logonResponse, out tableHandle, loopCount, createMessageRequest, saveChangesMessageRequest, releaseRequest);
            }

            #region RopBufferTooSmall response

            List <ISerializable> ropRequests1  = new List <ISerializable>();
            List <uint>          inputObjects1 = new List <uint>
            {
                this.inputObjHandle
            };
            List <IDeserializable>     ropResponses1 = new List <IDeserializable>();
            RopGetPropertiesAllRequest getPropertiesAllRequest;

            getPropertiesAllRequest.RopId            = (byte)RopId.RopGetPropertiesAll;
            getPropertiesAllRequest.LogonId          = TestSuiteBase.LogonId;
            getPropertiesAllRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;

            // Set PropertySizeLimit, which specifies the maximum size allowed for a property value returned.
            getPropertiesAllRequest.PropertySizeLimit = TestSuiteBase.PropertySizeLimit;

            getPropertiesAllRequest.WantUnicode = Convert.ToUInt16(TestSuiteBase.Zero);
            byte count = 255;
            for (byte i = 1; i < count; i++)
            {
                ropRequests1.Add(getPropertiesAllRequest);
            }

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

            // Verify the RopBufferTooSmall
            this.responseSOHs = cropsAdapter.ProcessMutipleRops(ropRequests1, inputObjects1, ref ropResponses1, ref this.rawData, RopResponseType.FailureResponse);

            #endregion

            List <IDeserializable> ropResponses4 = new List <IDeserializable>();

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

            // All the requests are GetPropertiesAllRequest, resubmit the request in another call and get the responses in the ropResponses4
            this.responseSOHs = cropsAdapter.ProcessMutipleRops(ropRequests1, inputObjects1, ref ropResponses4, ref this.rawData, RopResponseType.SuccessResponse);

            #region RopSetColumns success response

            RopSetColumnsRequest  setColumnsRequest;
            RopSetColumnsResponse setColumnsResponse;

            PropertyTag[] propertyTags = CreateSampleContentsTablePropertyTags();
            setColumnsRequest.RopId            = (byte)RopId.RopSetColumns;
            setColumnsRequest.LogonId          = TestSuiteBase.LogonId;
            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 2: Begin to send the RopSetColumns request.");

            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

            #region RopQueryRows success response: send RopSetColumns and RopQueryRows in a request buffer
            RopQueryRowsRequest queryRowsRequest;

            queryRowsRequest.RopId            = (byte)RopId.RopQueryRows;
            queryRowsRequest.LogonId          = TestSuiteBase.LogonId;
            queryRowsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            queryRowsRequest.QueryRowsFlags   = (byte)QueryRowsFlags.Advance;
            queryRowsRequest.ForwardRead      = TestSuiteBase.NonZero;

            // Set RowCount to 0x01, which the number of requested rows, as specified in [MS-OXCROPS].
            queryRowsRequest.RowCount = TestSuiteBase.RowCount;

            List <ISerializable> ropRequests = new List <ISerializable>
            {
                setColumnsRequest, queryRowsRequest
            };
            createMessageRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex2;
            createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex3;
            createMessageRequest.FolderId          = logonResponse.FolderIds[4];
            ropRequests.Add(createMessageRequest);
            saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex3;
            ropRequests.Add(saveChangesMessageRequest);
            List <uint> inputObjects = new List <uint>
            {
                tableHandle,
                0xFFFF,
                this.inputObjHandle,
                0xFFFF
            };

            // 0xFFFF indicates a default input handle.
            List <IDeserializable> ropResponses = new List <IDeserializable>();

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the multiple ROPs request to verify the RopNotify response.");

            // Verify the RopNotify
            this.responseSOHs = cropsAdapter.ProcessMutipleRops(ropRequests, inputObjects, ref ropResponses, ref this.rawData, RopResponseType.SuccessResponse);

            // Set RowCount to 0x0600, which the number of requested rows, as specified in [MS-OXCROPS].
            queryRowsRequest.RowCount = TestSuiteBase.RowCount;

            List <ISerializable> ropRequests2 = new List <ISerializable>
            {
                setColumnsRequest, queryRowsRequest
            };
            createMessageRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex2;
            createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex3;
            createMessageRequest.FolderId          = logonResponse.FolderIds[4];
            ropRequests2.Add(createMessageRequest);
            saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex3;
            ropRequests2.Add(saveChangesMessageRequest);
            List <uint> inputObjects2 = new List <uint>
            {
                tableHandle,
                0xFFFF,
                this.inputObjHandle,
                0xFFFF
            };

            // 0xFFFF indicates a default input handle.
            List <IDeserializable> ropResponses2 = new List <IDeserializable>();

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the multiple ROPs request to verify the RopPending response.");

            // Verify the RopPending
            this.responseSOHs = cropsAdapter.ProcessMutipleRops(ropRequests2, inputObjects2, ref ropResponses2, ref this.rawData, RopResponseType.SuccessResponse);

            bool isContainedRopPending = false;
            for (int i = 1; i < ropResponses2.Count; i++)
            {
                if (ropResponses2[i] is RopPendingResponse)
                {
                    isContainedRopPending = true;
                    break;
                }
            }

            // Send an empty ROP to verify all queued RopNotify response have got in last step.
            List <ISerializable>   ropRequestsEmpty = new List <ISerializable>(0x02);
            List <IDeserializable> ropResponsesNull = new List <IDeserializable>();

            this.responseSOHs = cropsAdapter.ProcessMutipleRops(ropRequestsEmpty, inputObjects, ref ropResponsesNull, ref this.rawData, RopResponseType.SuccessResponse);

            if (ropResponsesNull.Count == 0)
            {
                if (Common.IsRequirementEnabled(469303, this.Site))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R469303");

                    // Verify MS-OXCROPS requirement: MS-OXCROPS_R469303
                    Site.CaptureRequirementIfIsTrue(
                        isContainedRopPending,
                        469303,
                        @"[In Appendix B: Product Behavior] Implementation does include a RopPending ROP response (section 2.2.14.3) even though the ROP output buffer contains all queued RopNotify ROP responses (section 2.2.14.2). (<19> Section 3.1.5.1.3: Exchange 2007 follows this behavior.)");
                }

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

                    // Verify MS-OXCROPS requirement: MS-OXCROPS_R4693031
                    Site.CaptureRequirementIfIsFalse(
                        isContainedRopPending,
                        4693031,
                        @"[In Appendix B: Product Behavior] Implementation does not include a RopPending ROP response if the ROP output buffer contain all queued RopNotify ROP responses. (Exchange 2010 and above follow this behavior.)");
                }
            }
            #endregion

            #endregion
        }
        public void MSOXCROPS_S10_TC07_TestRopFastTransferSourceCopyProperties()
        {
            this.CheckTransportIsSupported();

            this.cropsAdapter.RpcConnect(
                Common.GetConfigurationPropertyValue("SutComputerName", this.Site),
                ConnectionType.PrivateMailboxServer,
                Common.GetConfigurationPropertyValue("UserEssdn", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                Common.GetConfigurationPropertyValue("UserName", this.Site),
                Common.GetConfigurationPropertyValue("PassWord", this.Site));

            // Step 1: Send the RopCreateMessage request to create a message
            #region RopCreateMessage success response

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

            // Create a message
            RopCreateMessageRequest  createMessageRequest = new RopCreateMessageRequest();
            RopCreateMessageResponse createMessageResponse;

            createMessageRequest.RopId = (byte)RopId.RopCreateMessage;

            createMessageRequest.LogonId           = TestSuiteBase.LogonId;
            createMessageRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;

            // Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used.
            createMessageRequest.CodePageId = TestSuiteBase.CodePageId;

            // Create a message in INBOX
            createMessageRequest.FolderId = logonResponse.FolderIds[4];

            // Set AssociatedFlag to 0x00(FALSE), which specifies the message is not a folder associated information (FAI) message.
            createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero);

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                createMessageRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            createMessageResponse = (RopCreateMessageResponse)response;
            Site.Assert.AreEqual <uint>(
                TestSuiteBase.SuccessReturnValue,
                createMessageResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");
            uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex];

            #endregion

            // Step 2: Send the RopSaveChangesMessage request to save changes
            #region RopSaveChangesMessage success response

            // Save message
            RopSaveChangesMessageRequest  saveChangesMessageRequest;
            RopSaveChangesMessageResponse saveChangesMessageResponse;

            saveChangesMessageRequest.RopId               = (byte)RopId.RopSaveChangesMessage;
            saveChangesMessageRequest.LogonId             = TestSuiteBase.LogonId;
            saveChangesMessageRequest.InputHandleIndex    = TestSuiteBase.InputHandleIndex0;
            saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1;
            saveChangesMessageRequest.SaveFlags           = (byte)SaveFlags.ForceSave;

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                saveChangesMessageRequest,
                targetMessageHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            saveChangesMessageResponse = (RopSaveChangesMessageResponse)response;
            Site.Assert.AreEqual <uint>(
                TestSuiteBase.SuccessReturnValue,
                saveChangesMessageResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success).");

            #endregion

            // Step 3: Send the RopFastTransferSourceCopyTo request to verify success response
            #region RopFastTransferSourceCopyTo response

            RopFastTransferSourceCopyPropertiesRequest fastTransferSourceCopyPropertiesRequest;

            PropertyTag[] messagePropertyTags = this.CreateMessageSamplePropertyTags();
            fastTransferSourceCopyPropertiesRequest.RopId             = (byte)RopId.RopFastTransferSourceCopyProperties;
            fastTransferSourceCopyPropertiesRequest.LogonId           = TestSuiteBase.LogonId;
            fastTransferSourceCopyPropertiesRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            fastTransferSourceCopyPropertiesRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;

            // This value specifies the level at which the copy is occurring, which is specified in [MS-OXCROPS].
            fastTransferSourceCopyPropertiesRequest.Level = TestSuiteBase.LevelOfNonZero;

            // Move: the client identifies the FastTransfer operation being configured as a logical part of a larger object move operation.
            fastTransferSourceCopyPropertiesRequest.CopyFlags = (byte)RopFastTransferSourceCopyPropertiesCopyFlags.Move;

            fastTransferSourceCopyPropertiesRequest.SendOptions      = (byte)SendOptions.Unicode;
            fastTransferSourceCopyPropertiesRequest.PropertyTagCount = (ushort)messagePropertyTags.Length;
            fastTransferSourceCopyPropertiesRequest.PropertyTags     = messagePropertyTags;

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                fastTransferSourceCopyPropertiesRequest,
                targetMessageHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);

            #endregion
        }
        public void MSOXCROPS_S10_TC01_TestRopFastTransferSourceCopyMessages()
        {
            this.CheckTransportIsSupported();

            this.cropsAdapter.RpcConnect(
                Common.GetConfigurationPropertyValue("SutComputerName", this.Site),
                ConnectionType.PrivateMailboxServer,
                Common.GetConfigurationPropertyValue("UserEssdn", this.Site),
                Common.GetConfigurationPropertyValue("Domain", this.Site),
                Common.GetConfigurationPropertyValue("UserName", this.Site),
                Common.GetConfigurationPropertyValue("PassWord", this.Site));

            // Step 1: Send the RopCreateMessage request to create a message
            #region RopCreateMessage success response

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

            // Create a message
            RopCreateMessageRequest  createMessageRequest = new RopCreateMessageRequest();
            RopCreateMessageResponse createMessageResponse;
            createMessageRequest.RopId = (byte)RopId.RopCreateMessage;

            createMessageRequest.LogonId           = TestSuiteBase.LogonId;
            createMessageRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;

            // Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used.
            createMessageRequest.CodePageId = TestSuiteBase.CodePageId;

            // Create a message in INBOX
            createMessageRequest.FolderId = logonResponse.FolderIds[4];

            // Set AssociatedFlag to 0x00(FALSE), which specifies the message is not a folder associated information (FAI) message.
            createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero);

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                createMessageRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            createMessageResponse = (RopCreateMessageResponse)response;
            Site.Assert.AreEqual <uint>(
                TestSuiteBase.SuccessReturnValue,
                createMessageResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");
            uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex];

            #endregion

            // Step 2: Send the RopSaveChangesMessage request to save changes
            #region RopSaveChangesMessage success response

            // Save message
            RopSaveChangesMessageRequest  saveChangesMessageRequest;
            RopSaveChangesMessageResponse saveChangesMessageResponse;
            saveChangesMessageRequest.RopId               = (byte)RopId.RopSaveChangesMessage;
            saveChangesMessageRequest.LogonId             = TestSuiteBase.LogonId;
            saveChangesMessageRequest.InputHandleIndex    = TestSuiteBase.InputHandleIndex0;
            saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1;
            saveChangesMessageRequest.SaveFlags           = (byte)SaveFlags.ForceSave;

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                saveChangesMessageRequest,
                targetMessageHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            saveChangesMessageResponse = (RopSaveChangesMessageResponse)response;
            Site.Assert.AreEqual <uint>(
                TestSuiteBase.SuccessReturnValue,
                saveChangesMessageResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success).");
            ulong messageId = saveChangesMessageResponse.MessageId;

            #endregion

            // Step 3: Send the RopOpenFolder request to open folder containing created message
            #region RopOpenFoldersuccess response

            // Open the folder(Inbox) containing the created message
            RopOpenFolderRequest  openFolderRequest;
            RopOpenFolderResponse openFolderResponse;

            openFolderRequest.RopId             = (byte)RopId.RopOpenFolder;
            openFolderRequest.LogonId           = TestSuiteBase.LogonId;
            openFolderRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;

            // Inbox will be opened
            openFolderRequest.FolderId = logonResponse.FolderIds[4];

            openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None;

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                openFolderRequest,
                this.inputObjHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            openFolderResponse = (RopOpenFolderResponse)response;
            Site.Assert.AreEqual <uint>(
                TestSuiteBase.SuccessReturnValue,
                openFolderResponse.ReturnValue,
                "If ROP succeeds, the ReturnValue of its response is 0 (success).");
            uint folderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];

            ulong[] messageIds = new ulong[1];
            messageIds[0] = messageId;

            #endregion

            // Step 4: Send the RopFastTransferSourceCopyMessages request to verify success response
            #region RopFastTransferSourceCopyMessages success response

            RopFastTransferSourceCopyMessagesRequest  fastTransferSourceCopyMessagesRequest;
            RopFastTransferSourceCopyMessagesResponse fastTransferSourceCopyMessagesResponse;

            fastTransferSourceCopyMessagesRequest.RopId             = (byte)RopId.RopFastTransferSourceCopyMessages;
            fastTransferSourceCopyMessagesRequest.LogonId           = TestSuiteBase.LogonId;
            fastTransferSourceCopyMessagesRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            fastTransferSourceCopyMessagesRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            fastTransferSourceCopyMessagesRequest.MessageIdCount    = (ushort)messageIds.Length;
            fastTransferSourceCopyMessagesRequest.MessageIds        = messageIds;
            fastTransferSourceCopyMessagesRequest.CopyFlags         = (byte)RopFastTransferSourceCopyMessagesCopyFlags.BestBody;
            fastTransferSourceCopyMessagesRequest.SendOptions       = (byte)SendOptions.ForceUnicode;

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

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                fastTransferSourceCopyMessagesRequest,
                folderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            fastTransferSourceCopyMessagesResponse = (RopFastTransferSourceCopyMessagesResponse)response;

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

            #endregion
        }