Microsoft.Protocols.TestSuites.MS_OXCROPS.S06_PropertyROPs.MSOXCROPS_S06_TC02_TestRopsCopy C# (CSharp) Method

MSOXCROPS_S06_TC02_TestRopsCopy() private method

private MSOXCROPS_S06_TC02_TestRopsCopy ( ) : void
return void
        public void MSOXCROPS_S06_TC02_TestRopsCopy()
        {
            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: Send the RopCopyTo request and verify the success response.
            #region RopCopyTo success response

            #region Common operations

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

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

            // Call GetOpenedFolderHandle method to get the opened folder handle.
            uint openedFolderHandle = this.GetOpenedFolderHandle(logonResponse.FolderIds[5], inputObjHandle);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 1:Call GetCreatedFolderHandle method to create a folder and get the created folder handle.");

            // Call GetCreatedFolderHandle method to create a folder and get the created folder handle.
            uint createdFolderHandle1 = this.GetCreatedFolderHandle(openedFolderHandle, 1);

            // Call GetCreatedFolderHandle method to create a folder and get the created folder handle.
            uint createdFolderHandle2 = this.GetCreatedFolderHandle(openedFolderHandle, 2);

            List<uint> handleList = new List<uint>
            {
                createdFolderHandle1, createdFolderHandle2
            };

            #endregion

            RopCopyToRequest copyToRequest;
            RopCopyToResponse copyToResponse;

            copyToRequest.RopId = (byte)RopId.RopCopyTo;

            copyToRequest.LogonId = TestSuiteBase.LogonId;

            // Set SourceHandleIndex, which specifies the location in the Server object handle table where the handle
            // for the source Server object is stored.
            copyToRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex0;

            // Set DestHandleIndex, which specifies the location in the Server object handle table where the handle
            // for the destination Server object is stored.
            copyToRequest.DestHandleIndex = TestSuiteBase.DestHandleIndex;

            copyToRequest.WantAsynchronous = Convert.ToByte(TestSuiteBase.Zero);
            copyToRequest.WantSubObjects = Convert.ToByte(TestSuiteBase.Zero);
            copyToRequest.CopyFlags = (byte)RopCopyToCopyFlags.NoOverwrite;

            // Set ExcludedTagCount, which specifies how many tags are present in ExcludedTags.
            copyToRequest.ExcludedTagCount = TestSuiteBase.ExcludedTagCount;

            copyToRequest.ExcludedTags = null;

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

            // Send the RopCopyTo request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyToRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            copyToResponse = (RopCopyToResponse)response;

            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                copyToResponse.ReturnValue,
                "if ROP succeeds, ReturnValue of its response will be 0 (success)");

            #endregion

            // Step 2: Send the RopCopyTo request and verify the failure response.
            #region RopCopyTo failure response

            // Set SourceHandleIndex and CopyFlags to invalid values, this will lead to a failure response.
            copyToRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex1;
            copyToRequest.CopyFlags = TestSuiteBase.InvalidCopyFlags;

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

            // Send the RopCopyTo request and verify the failure response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyToRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.FailureResponse);
            copyToResponse = (RopCopyToResponse)response;

            Site.Assert.AreNotEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                copyToResponse.ReturnValue,
                "if ROP succeeds, ReturnValue of its response will not be 0");
            Site.Assert.AreNotEqual<uint>(
                MS_OXCROPSAdapter.ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                copyToResponse.ReturnValue,
                "if ROP succeeds, ReturnValue of its response will not be 0x00000503");

            #endregion

            // Step 3: Send the RopCopyTo request and verify the null destination failure response.
            #region RopCopyTo null destination failure response

            // Because the failure response modify its value, so change it to correct.
            copyToRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex0;

            handleList.RemoveAt(1);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopCopyTo request to invoke null destination failure response.");

            // Send the RopCopyTo request and verify the null destination failure response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyToRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.NullDestinationFailureResponse);
            copyToResponse = (RopCopyToResponse)response;

            Site.Assert.AreEqual<uint>(
                MS_OXCROPSAdapter.ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                copyToResponse.ReturnValue,
                "if ROP null destination failure response, ReturnValue of its response will be 0x00000503");

            #endregion

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

            RopCopyPropertiesRequest copyPropertiesRequest;
            RopCopyPropertiesResponse copyPropertiesResponse;

            copyPropertiesRequest.RopId = (byte)RopId.RopCopyProperties;
            copyPropertiesRequest.LogonId = TestSuiteBase.LogonId;
            copyPropertiesRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex0;
            copyPropertiesRequest.DestHandleIndex = TestSuiteBase.DestHandleIndex;
            copyPropertiesRequest.WantAsynchronous = Convert.ToByte(TestSuiteBase.Zero);
            copyPropertiesRequest.CopyFlags = (byte)RopCopyPropertiesCopyFlags.NoOverwrite;

            // Call CreateFolderPropertyTags method to create property tags for folder, then set it to PropertyTags.
            PropertyTag[] tagArray = this.CreateFolderPropertyTags();
            copyPropertiesRequest.PropertyTagCount = (ushort)tagArray.Length;
            copyPropertiesRequest.PropertyTags = tagArray;
            handleList.Add(createdFolderHandle2);

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

            // Send the RopCopyProperties request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyPropertiesRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            copyPropertiesResponse = (RopCopyPropertiesResponse)response;

            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                copyPropertiesResponse.ReturnValue,
                "if ROP succeeds, ReturnValue of its response will be 0 (success)");

            #endregion

            // Step 5: Send the RopCopyProperties request and verify the failure response.
            #region RopCopyProperties failure response

            copyPropertiesRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex1;

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

            // Send the RopCopyProperties request and verify the failure response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyPropertiesRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.FailureResponse);
            copyPropertiesResponse = (RopCopyPropertiesResponse)response;

            Site.Assert.AreNotEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                copyPropertiesResponse.ReturnValue,
                "if ROP failure, ReturnValue of its response will not be 0 (success)");
            Site.Assert.AreNotEqual<uint>(
                MS_OXCROPSAdapter.ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                copyPropertiesResponse.ReturnValue,
                "if ROP failure, ReturnValue of its response will not be 0x000000503 (null destination failure response)");

            #endregion

            // Step 6: Send the RopCopyProperties request and verify the null destination failure response.
            #region RopCopyProperties null destination failure response

            handleList.RemoveAt(1);

            copyPropertiesRequest.SourceHandleIndex = TestSuiteBase.SourceHandleIndex0;

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

            // Send the RopCopyProperties request and verify the null destination failure response.
            this.responseSOHs = cropsAdapter.ProcessSingleRopWithMutipleServerObjects(
                copyPropertiesRequest,
                handleList,
                ref this.response,
                ref this.rawData,
                RopResponseType.NullDestinationFailureResponse);
            copyPropertiesResponse = (RopCopyPropertiesResponse)response;

            Site.Assert.AreEqual<uint>(
                MS_OXCROPSAdapter.ReturnValueForRopMoveFolderResponseAndMoveCopyMessage,
                copyPropertiesResponse.ReturnValue,
                "if ROP null destination failure, ReturnValue of its response will be 0x000000503");

            #endregion
        }