コード例 #1
0
        /// <summary>
        /// Move tasks on the server according to items' id.
        /// </summary>
        /// <param name="itemIds">The item id of tasks which will be moved.</param>
        /// <returns>The extracted items id array.</returns>
        protected ItemIdType[] MoveTasks(params ItemIdType[] itemIds)
        {
            // Define the MoveItem request.
            MoveItemType moveItemRequest = TestSuiteHelper.GenerateMoveItemRequest(itemIds);

            // Call the MoveItem method to move the task items created in previous steps.
            MoveItemResponseType moveItemResponse = this.TASKAdapter.MoveItem(moveItemRequest);

            this.VerifyResponseMessage(moveItemResponse);

            // Save the ItemId of task item got from the MoveItem response.
            return(Common.GetItemIdsFromInfoResponse(moveItemResponse));
        }
コード例 #2
0
        /// <summary>
        /// Move contact item on the server.
        /// </summary>
        /// <param name="moveItemRequest">The request of MoveItem operation.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResoponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            #region Verify MoveItem operation requirements

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveContactItem(this.exchangeServiceBinding.IsSchemaValidated);
            #endregion

            return(moveItemResoponse);
        }
コード例 #3
0
        /// <summary>
        /// Move items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specify a request to move items on the server.</param>
        /// <returns>A response to MoveItem operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType response = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");

            // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported.
            this.VerifySoapVersion();

            // Verify transport type related requirement.
            this.VerifyTransportType();

            this.VerifyMoveItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated);
            return(response);
        }
コード例 #4
0
        /// <summary>
        /// Move the calendar related item elements.
        /// </summary>
        /// <param name="request">A request to the MoveItem operation.</param>
        /// <returns>The response message returned by MoveItem operation.</returns>
        public MoveItemResponseType MoveItem(MoveItemType request)
        {
            if (request == null)
            {
                throw new ArgumentException("The request of operation 'MoveItem' should not be null.");
            }

            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(request);

            Site.Assert.IsNotNull(moveItemResponse, "If the operation is successful, the response should not be null.");

            this.VerifySoapVersion();
            this.VerifyTransportType();
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);
            return(moveItemResponse);
        }
コード例 #5
0
        /// <summary>
        /// Verify the WSDL port type specifications for the MoveItem operation and MoveItemResponseType structure.
        /// </summary>
        /// <param name="moveItemResponse">The response got from server via MoveItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyMoveItemOperation(MoveItemResponseType moveItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false,
            // which indicates the schema is not matched with the expected result.
            // So this requirement can be verified when the isSchemaValidation is true.

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R157");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R157
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                157,
                @"[In MoveItem] The following is the WSDL port type specification of the MoveItem operation. <wsdl:operation name=""MoveItem"">
    <wsdl:input message=""tns:MoveItemSoapIn"" />
    <wsdl:output message=""tns:MoveItemSoapOut"" />
</wsdl:operation>");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R159");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R159
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                159,
                @"[In MoveItem] The following is the WSDL binding specification of the MoveItem operation. <wsdl:operation name=""MoveItem"">
    <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/MoveItem"" />
    <wsdl:input>
        <soap:header message=""tns:MoveItemSoapIn"" part=""Impersonation"" use=""literal""/>
        <soap:header message=""tns:MoveItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
        <soap:header message=""tns:MoveItemSoapIn"" part=""RequestVersion"" use=""literal""/>
        <soap:body parts=""request"" use=""literal"" />
    </wsdl:input>
    <wsdl:output>
        <soap:body parts=""MoveItemResult"" use=""literal"" />
        <soap:header message=""tns:MoveItemSoapOut"" part=""ServerVersion"" use=""literal""/>
    </wsdl:output>
</wsdl:operation>");

            ItemInfoResponseMessageType item = moveItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;

            if (item.Items.Items[0] is MessageType)
            {
                MessageType messageItem = item.Items.Items[0] as MessageType;
                this.VerifyMessageType(messageItem, isSchemaValidated);
            }
        }
コード例 #6
0
        /// <summary>
        /// Moves Task items on the server.
        /// </summary>
        /// <param name="moveItemRequest">Specifies a request to move Task items on the server.</param>
        /// <returns>A response to this operation request.</returns>
        public MoveItemResponseType MoveItem(MoveItemType moveItemRequest)
        {
            MoveItemResponseType moveItemResponse = this.exchangeServiceBinding.MoveItem(moveItemRequest);

            Site.Assert.IsNotNull(moveItemResponse, "If the operation is successful, the response should not be null.");

            // Verify the move item operation.
            this.VerifyMoveItemOperation(moveItemResponse, this.exchangeServiceBinding.IsSchemaValidated);

            // Verify Soap version requirements.
            this.VerifySoapVersion();

            // Verify transport requirements.
            this.VerifyTransportType();

            return(moveItemResponse);
        }
コード例 #7
0
        public void MSOXWSCORE_S08_TC03_MoveTypesOfItemsSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create Items.
            ItemIdType[] createdItemIds = CreateAllTypesItems();
            #endregion

            #region Step 2: Move items.
            // Clear ExistItemIds for MoveItem
            this.InitializeCollection();

            MoveItemResponseType moveItemResponse = this.CallMoveItemOperation(DistinguishedFolderIdNameType.deleteditems, createdItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(moveItemResponse, createdItemIds.Length, this.Site);

            #endregion

            this.FindNewItemsInFolder(DistinguishedFolderIdNameType.deleteditems);
        }
コード例 #8
0
        /// <summary>
        /// Moves the given message to the given folder.
        /// </summary>
        public void MoveMessageToFolder(ItemIdType messageId, string folderId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            var request = new MoveItemType
            {
                ItemIds    = new BaseItemIdType[] { messageId },
                ToFolderId = new TargetFolderIdType {
                    Item = new FolderIdType {
                        Id = folderId
                    }
                }
            };

            MoveItemResponseType moveItemResponse = binding.MoveItem(request);

            if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
            {
                throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText);
            }
        }
コード例 #9
0
        public void MSOXWSCONT_S04_TC01_MoveContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the moved contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the original contact item Id.
            // Call GetItem operation.
            getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorItemNotFound,
                getItemResponse.ResponseMessages.Items[0].ResponseCode,
                string.Format(
                    "Get contact item with original item Id should fail! Expected response code: {0}, actual response code: {1}",
                    ResponseCodeType.ErrorItemNotFound,
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion
        }
コード例 #10
0
        public void MSOXWSCONT_S04_TC01_MoveContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2:Move the contact item.
            MoveItemType moveItemRequest = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the moved contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the original contact item Id.
            // Call GetItem operation.
            getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual<int>(
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0),
                 "Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorItemNotFound,
                getItemResponse.ResponseMessages.Items[0].ResponseCode,
                string.Format(
                    "Get contact item with original item Id should fail! Expected response code: {0}, actual response code: {1}",
                    ResponseCodeType.ErrorItemNotFound,
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion
        }
コード例 #11
0
        /// <summary>
        /// Verify the MoveItemResponseType structure.
        /// </summary>
        /// <param name="moveItemResponse">A MoveItemResponseType instance.</param>
        /// <param name="isSchemaValidated">Indicate whether schema is verified.</param>
        private void VerifyMoveItemResponse(MoveItemResponseType moveItemResponse, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema should be validated.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R389");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R389
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                389,
                @"[In MoveItem Operation] The following is the WSDL port type specification for the MoveItem operation: 
                    <wsdl:operation name=""MoveItem"">
                       <wsdl:input message=""tns:MoveItemSoapIn""/>
                       <wsdl:output message=""tns:MoveItemSoapOut""/>
                    </wsdl:operation>");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R390");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R390
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                390,
                @"[In MoveItem Operation] The following is the WSDL binding specification for the MoveItem operation: 
                    <wsdl:operation name=""MoveItem"">
                       <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/MoveItem""/>
                       <wsdl:input>
                          <soap:header message=""tns:MoveItemSoapIn"" part=""Impersonation"" use=""literal""/>
                          <soap:header message=""tns:MoveItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
                           <soap:header message=""tns:MoveItemSoapIn"" part=""RequestVersion"" use=""literal""/>
                          <soap:body parts=""request"" use=""literal""/>
                       </wsdl:input>
                       <wsdl:output>
                          <soap:body parts=""MoveItemResult"" use=""literal""/>
                          <soap:header message=""tns:MoveItemSoapOut"" part=""ServerVersion"" use=""literal""/>
                       </wsdl:output>
                    </wsdl:operation>");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2182");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2182
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                2182,
                @" [In tns:MoveItemSoapOut Message] [The MoveItemSoapOut WSDL message is defined as:]
                   <wsdl:message name=""MoveItemSoapOut"">
                       <wsdl:part name=""MoveItemResult"" element=""tns:MoveItemResponse""/>
                       <wsdl:part name=""ServerVersion"" element=""t:ServerVersionInfo""/>
                   </wsdl:message>");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R414");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R414
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                414,
                @"[In m:MoveItemResponse Element] [The MoveItemResponse element is defined as:]
                    <xs:element name=""MoveItemResponse""
                      type=""m:MoveItemResponseType""
                     />");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1448");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1448
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                1448,
                @"[In tns:MoveItemSoapOut Message] The type of MoveItemResult is tns:MoveItemResponse (section 3.1.4.7.2.2).");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R406");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R406
            // According to the schema, moveItemResponse is the SOAP body of a response message returned by server, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                406,
                @"[In tns:MoveItemSoapOut Message] [The part ""MoveItemResult""] Specifies the SOAP body of a response message.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1449");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1449
            Site.CaptureRequirementIfIsNotNull(
                this.exchangeServiceBinding.ServerVersionInfoValue,
                1449,
                @"[In tns:MoveItemSoapOut Message] The type of ServerVersion is t:ServerVersionInfo ([MS-OXWSCDATA] section 2.2.5.10).");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R407");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R407
            // According to the schema, ServerVersion is the SOAP header that contains the server version information, 
            // this requirement can be verified directly.
            Site.CaptureRequirement(
                407,
                @"[In tns:MoveItemSoapOut Message] [The part ""ServerVersion""] Specifies a SOAP header that identifies the server version for the response to a MoveItem operation request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R420");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R420
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                420,
                @"[In m:MoveItemResponseType Complex Type] [The MoveItemResponseType complex type is defined as:]
                    <xs:complexType name=""MoveItemResponseType"">
                      <xs:complexContent>
                        <xs:extension
                          base=""m:BaseResponseMessageType""
                         />
                      </xs:complexContent>
                    </xs:complexType>");

            // Verify the BaseResponseMessageType schema.
            this.VerifyBaseResponseMessageType(moveItemResponse);

            foreach (ItemInfoResponseMessageType info in moveItemResponse.ResponseMessages.Items)
            {
                this.VerifyItemInfoResponseMessageType(info);
            }

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R219");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R219
            // The request of MoveItem operation is formed according to schema
            // And the response of MoveItem operation is returned by server according to schema
            // This requirement can be verified directly.
            Site.CaptureRequirement(
                219,
                @"[In Message Processing Events and Sequencing Rules] [The operation ""MoveItem""] Moves items on the server.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R388");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R388
            // The request of MoveItem operation is formed according to schema
            // And the response of MoveItem operation is returned by server according to schema
            // This requirement can be verified directly.
            Site.CaptureRequirement(
                388,
                @"[In MoveItem Operation] The MoveItem operation moves items on the server.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R413");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R413
            // This requirement can be captured directly, since MoveItemResponse is the response of a MoveItem operation request.
            Site.CaptureRequirement(
                413,
                @"[In m:MoveItemResponse Element] The MoveItemResponse element specifies a response to a MoveItem operation request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R410");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R410
            // This requirement can be captured directly, since MoveItemResponse is the response of a MoveItem operation request.
            Site.CaptureRequirement(
                410,
                @"[In Elements] [The element ""MoveItemResponse""] Specifies a response to a MoveItem operation request.");
        }
コード例 #12
0
        public void MSOXWSCORE_S01_TC03_MoveItemSuccessfully()
        {
            #region Step 1: Create the item.
            ItemType item = new ItemType();
            ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Move the item.

            MoveItemType moveItemRequest = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds = createdItemIds;

            // Clear ExistItemIds for MoveItem.
            this.InitializeCollection();

            // Configure moving item to inbox folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox;
            moveItemRequest.ToFolderId = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;
            moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);

            ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);

            // One moved item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 movedItemIds.GetLength(0),
                 "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 movedItemIds.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R419");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R419
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                419,
                @"[In m:MoveItemResponseType Complex Type] The MoveItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R46");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R46
            // If the schema is validated, this requirement can be captured.
            this.Site.CaptureRequirement(
                46,
                @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ItemIds""] Specifies an array of elements of type BaseItemIdType that specifies a set of items to be moved.");

            ItemInfoResponseMessageType moveItemResponseMessage = moveItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1601");

            // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1601
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponseMessage,
                "MS-OXWSCDATA",
                1601,
                @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" is ""m:ItemInfoResponseMessageType"" type (section 2.2.4.37).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1056");

            // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1056
            // The schema is validated and the response is not null, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                moveItemResponseMessage,
                "MS-OXWSCDATA",
                1056,
                @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" with type ""m:ItemInfoResponseMessageType(section 2.2.4.37)"" specifies the response message for the MoveItem operation ([MS-OXWSCORE] section 3.1.4.7).");
            #endregion

            #region Step 3: Get the created item failed.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual<int>(
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0),
                 "Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual<ResponseClassType>(
                ResponseClassType.Error,
                getItemResponse.ResponseMessages.Items[0].ResponseClass,
                string.Format(
                    "Get item operation should be failed with error! Actual response code: {0}",
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion

            #region Step 4: Get the moved item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(movedItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 getItemIds.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemIds.GetLength(0));

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R45");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R45
            // If the moved item was got successfully, R45 can be captured.
            this.Site.CaptureRequirement(
                45,
                @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ToFolderId""] Specifies an instance of the TargetFolderIdType complex type that specifies the folder to which the items specified by the ItemIds property are to be moved.");
            #endregion
        }
コード例 #13
0
        public void MSOXWSMSG_S06_TC01_OperateMultipleMessages()
        {
            #region Create multiple message
            string subject        = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0);
            string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1);

            CreateItemType createItemRequest = new CreateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,

                // MessageDispositionSpecified value needs to be set.
                MessageDispositionSpecified = true,

                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.drafts
                    }
                },

                Items = new NonEmptyArrayOfAllItemsType
                {
                    // Create an responseMessageItem with two MessageType instances.
                    Items = new MessageType[]
                    {
                        new MessageType
                        {
                            Sender = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    EmailAddress = this.Sender
                                }
                            },

                            ToRecipients = new EmailAddressType[]
                            {
                                new EmailAddressType
                                {
                                    EmailAddress = this.Recipient1
                                }
                            },

                            Subject = subject,
                        },

                        new MessageType
                        {
                            Sender = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    EmailAddress = this.Sender
                                }
                            },

                            ToRecipients = new EmailAddressType[]
                            {
                                new EmailAddressType
                                {
                                    EmailAddress = this.Recipient2
                                }
                            },

                            Subject = anotherSubject,
                        }
                    }
                },
            };

            CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the first ItemId of message responseMessageItem got from the createItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            ItemIdType itemIdType1 = new ItemIdType();
            itemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the second ItemId.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            ItemIdType itemIdType2 = new ItemIdType();
            itemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Get the multiple messages which created
            GetItemType getItemRequest = new GetItemType
            {
                // Set the two ItemIds got from CreateItem response.
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2
                },

                ItemShape = new ItemResponseShapeType
                {
                    BaseShape = DefaultShapeNamesType.AllProperties,
                }
            };

            GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages.");
            #endregion

            #region Update the multiple messages which created
            UpdateItemType updateItemRequest = new UpdateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,

                // MessageDispositionSpecified value needs to be set.
                MessageDispositionSpecified = true,

                // Create two ItemChangeType instances.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType
                    {
                        Item = itemIdType1,

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType
                            {
                                Item = new PathToUnindexedFieldType
                                {
                                    FieldURI = UnindexedFieldURIType.messageToRecipients
                                },

                                // Update ToRecipients property of the first message.
                                Item1 = new MessageType
                                {
                                    ToRecipients = new EmailAddressType[]
                                    {
                                        new EmailAddressType
                                        {
                                            EmailAddress = this.Recipient2
                                        }
                                    }
                                }
                            },
                        }
                    },

                    new ItemChangeType
                    {
                        Item = itemIdType2,

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType
                            {
                                Item = new PathToUnindexedFieldType
                                {
                                    FieldURI = UnindexedFieldURIType.messageToRecipients
                                },

                                // Update ToRecipients property of the second message.
                                Item1 = new MessageType
                                {
                                    ToRecipients = new EmailAddressType[]
                                    {
                                        new EmailAddressType
                                        {
                                            EmailAddress = this.Recipient1
                                        }
                                    }
                                }
                            },
                        }
                    }
                }
            };

            UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the UpdateItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the UpdateItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            itemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Copy the updated multiple message to junkemail
            CopyItemType copyItemRequest = new CopyItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2,
                },

                // Copy the message to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the CopyItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            ItemIdType copyItemIdType1 = new ItemIdType();
            copyItemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the CopyItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            ItemIdType copyItemIdType2 = new ItemIdType();
            copyItemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Move the copied multiple message from junkemail to deleteditems
            MoveItemType moveItemRequest = new MoveItemType
            {
                // Set to copied message responseMessageItem id.
                ItemIds = new ItemIdType[]
                {
                    copyItemIdType1,
                    copyItemIdType2
                },

                // Move the copied messages to deleted items folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.deleteditems
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of the first message responseMessageItem got from the MoveItem response.
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            copyItemIdType1.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Save the ItemId of the second message responseMessageItem got from the MoveItem response.
            this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0);
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null.");
            copyItemIdType2.Id        = this.firstItemOfSecondInfoItem.ItemId.Id;
            copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey;
            #endregion

            #region Send multiple messages
            SendItemType sendItemRequest = new SendItemType
            {
                // Set to the two updated messages' ItemIds.
                ItemIds = new ItemIdType[]
                {
                    itemIdType1,
                    itemIdType2
                },

                // Do not save copy.
                SaveItemToFolder = false,
            };

            SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages.");
            #endregion

            #region Delete the copied messages
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                // Set to the two copied messages' ItemIds.
                ItemIds = new ItemIdType[]
                {
                    copyItemIdType1,
                    copyItemIdType2
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion

            #region Clean up Recipient1's and Recipient2's inbox folders
            bool isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Recipient2", this.Site),
                Common.GetConfigurationPropertyValue("Recipient2Password", this.Site),
                this.Domain,
                subject,
                "inbox");
            Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up.");

            isClear = this.MSGSUTControlAdapter.CleanupFolders(
                Common.GetConfigurationPropertyValue("Recipient1", this.Site),
                Common.GetConfigurationPropertyValue("Recipient1Password", this.Site),
                this.Domain,
                anotherSubject,
                "inbox");
            Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up.");
            #endregion
        }
コード例 #14
0
        public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements()
        {
            #region Step 1:Create the contact item.
            // Create a contact item without optional elements.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);
            #endregion

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);
            #endregion

            #region Step 5:Copy the contact item.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[1];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            #endregion
        }
コード例 #15
0
        public void MSOXWSMSG_S04_TC02_MoveMessageUnsuccessful()
        {
            #region Create message
            CreateItemType         createItemRequest  = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts);
            CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest);
            Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);

            // Save the ItemId of message responseMessageItem got from the createItem response.
            ItemIdType itemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            #endregion

            #region Delete the message created
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                    this.firstItemOfFirstInfoItem.ItemId
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion

            #region Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R163001");

            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Error,
                moveItemResponse.ResponseMessages.Items[0].ResponseClass,
                163001,
                @"[In MoveItem] If the MoveItem WSDL operation request is not successful, it returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R163002");

            this.Site.CaptureRequirementIfIsTrue(
                System.Enum.IsDefined(typeof(ResponseCodeType), moveItemResponse.ResponseMessages.Items[0].ResponseCode),
                163002,
                @"[In MoveItem] [A unsuccessful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element of the MoveItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24.");

            #endregion
        }
コード例 #16
0
        public void MSOXWSMTGS_S04_TC05_MoveItemErrorCalendarCannotUseIdForOccurrenceId()
        {
            #region Define a meeting
            int timeInterval             = this.TimeInterval;
            CalendarItemType meetingItem = new CalendarItemType();
            meetingItem.UID     = Guid.NewGuid().ToString();
            meetingItem.Subject = this.Subject;
            meetingItem.Start   = DateTime.UtcNow;

            meetingItem.StartSpecified = true;
            timeInterval++;
            meetingItem.End          = DateTime.Now.AddHours(timeInterval);
            meetingItem.EndSpecified = true;
            meetingItem.Location     = this.Location;

            meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };

            // Create the  meeting
            ItemInfoResponseMessageType itemInfo = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy);
            Site.Assert.IsNotNull(itemInfo, "Server should return success for creating a recurring meeting.");

            CalendarItemType calendarInOrganizer = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendarInOrganizer, "The meeting should be found in organizer's Calendar folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy.");
            #endregion

            #region Define a recurring calendar item to move
            DateTime startTime = DateTime.Now;

            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = this.PatternInterval;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = this.NumberOfOccurrences;
            range.StartDate           = startTime;

            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID              = Guid.NewGuid().ToString();
            calendarItem.Subject          = this.Subject;
            calendarItem.Start            = startTime;
            calendarItem.StartSpecified   = true;
            calendarItem.End              = startTime.AddHours(this.TimeInterval);
            calendarItem.EndSpecified     = true;
            calendarItem.Recurrence       = new RecurrenceType();
            calendarItem.Recurrence.Item  = pattern;
            calendarItem.Recurrence.Item1 = range;
            #endregion

            #region Create the recurring calendar item and extract the Id of an occurrence item
            ItemInfoResponseMessageType item             = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);
            OccurrenceItemIdType        occurrenceItemId = new OccurrenceItemIdType();
            occurrenceItemId.ChangeKey         = item.Items.Items[0].ItemId.ChangeKey;
            occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id;
            occurrenceItemId.InstanceIndex     = this.InstanceIndex;
            #endregion

            #region Get the Id of the occurrence item
            ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Organizer, occurrenceItemId);
            Site.Assert.IsNotNull(getItem, "Organizer should get the occurrence item successfully.");

            RecurringMasterItemIdType recurringMasterItemId = new RecurringMasterItemIdType();
            recurringMasterItemId.ChangeKey    = getItem.Items.Items[0].ItemId.ChangeKey;
            recurringMasterItemId.OccurrenceId = calendarInOrganizer.ItemId.Id;
            #endregion

            #region Move the recurring calendar item to Inbox folder
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.inbox;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds    = new BaseItemIdType[] { recurringMasterItemId };
            moveItemRequest.ToFolderId = targetFolderId;
            MoveItemResponseType response = this.MTGSAdapter.MoveItem(moveItemRequest);
            #endregion

            #region Capture code
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1232");

            //Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1232
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotUseIdForOccurrenceId,
                response.ResponseMessages.Items[0].ResponseCode,
                1232,
                @"[In Messages] ErrorCalendarCannotUseIdForOccurrenceId: Specifies that the OccurrenceId ([MS-OXWSCORE] section 2.2.4.39) does not correspond to a valid occurrence of a recurring master item.");
            #endregion

            #region Clean up organizer's calendar, sentitems and deleteditems folders and attendee's calendar, inbox and deleteditems folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType> {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems
            });
            this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.deleteditems
            });
            #endregion
        }
コード例 #17
0
        /// <summary>
        /// Verify the MoveItemResponseType structure.
        /// </summary>
        /// <param name="moveItemResponse">The response got from server via MoveItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyMoveItemOperation(MoveItemResponseType moveItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false, 
            // which indicates the schema is not matched with the expected result. 
            // So these requirement can be verified when the isSchemaValidation is true.

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R183");

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R183
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                183,
                @"[In MoveItem Operation] The following is the WSDL port type specification for the MoveItem operation. <wsdl:operation name=""MoveItem"">
                   <wsdl:input message=""tns:MoveItemSoapIn"" />
                   <wsdl:output message=""tns:MoveItemSoapOut"" />
                </wsdl:operation>");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R185");

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R185
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                185,
                @"[In MoveItem Operation] The following is the WSDL binding specification for the MoveItem operation. <wsdl:operation name=""MoveItem"">
                   <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/MoveItem""/>
                   <wsdl:input>
                      <soap:header message=""tns:MoveItemSoapIn"" part=""Impersonation"" use=""literal""/>
                      <soap:header message=""tns:MoveItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
                      <soap:header message=""tns:MoveItemSoapIn"" part=""RequestVersion"" use=""literal""/>
                      <soap:body parts=""request"" use=""literal""/>
                   </wsdl:input>
                   <wsdl:output>
                      <soap:body parts=""MoveItemResult"" use=""literal""/>
                      <soap:header message=""tns:MoveItemSoapOut"" part=""ServerVersion"" use=""literal""/>
                   </wsdl:output>
                </wsdl:operation>");

            if (moveItemResponse.ResponseMessages.Items != null && moveItemResponse.ResponseMessages.Items.Length > 0)
            {
                foreach (ItemInfoResponseMessageType itemInfo in moveItemResponse.ResponseMessages.Items)
                {
                    if (itemInfo.ResponseClass == ResponseClassType.Success)
                    {
                        this.VerifyTaskType(isSchemaValidated, itemInfo);
                    }
                }
            }
        }
コード例 #18
0
        public void MSOXWSCONT_S05_TC01_OperateMultipleContactItems()
        {
            #region Step 1:Create the contact item.
            CreateItemType createItemRequest = new CreateItemType();

            #region Config the contact items
            createItemRequest.Items       = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ContactItemType[2];

            // Create the first contact item.
            createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties();

            // Create the second contact item.
            createItemRequest.Items.Items[1] = this.BuildContactItemWithRequiredProperties();

            // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder.
            createItemRequest.SavedItemFolderId = new TargetFolderIdType()
            {
                Item = new DistinguishedFolderIdType()
                {
                    Id = DistinguishedFolderIdNameType.contacts,
                }
            };
            #endregion

            CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(createItemResponse, 2, this.Site);
            #endregion

            #region Step 2:Update the contact items.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    },
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[1],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastCommaFirst.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 2, this.Site);
            #endregion

            #region Step 3:Move the contact items.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[2];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];
            moveItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 2, this.Site);
            #endregion

            #region Step 4:Get the contact items.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 2, this.Site);
            #endregion

            #region Step 5:Copy the contact items.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[2];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];
            copyItemRequest.ItemIds[1] = this.ExistContactItems[1];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 2, this.Site);
            #endregion
        }
コード例 #19
0
        public void MSOXWSMTGS_S04_TC04_MoveItemErrorCalendarCannotMoveOrCopyOccurrence()
        {
            #region Define a recurring calendar item
            DateTime startTime = DateTime.Now;

            DailyRecurrencePatternType pattern = new DailyRecurrencePatternType();
            pattern.Interval = this.PatternInterval;

            NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
            range.NumberOfOccurrences = this.NumberOfOccurrences;
            range.StartDate           = startTime;

            CalendarItemType calendarItem = new CalendarItemType();
            calendarItem.UID              = Guid.NewGuid().ToString();
            calendarItem.Subject          = this.Subject;
            calendarItem.Start            = startTime;
            calendarItem.StartSpecified   = true;
            calendarItem.End              = startTime.AddHours(this.TimeInterval);
            calendarItem.EndSpecified     = true;
            calendarItem.Recurrence       = new RecurrenceType();
            calendarItem.Recurrence.Item  = pattern;
            calendarItem.Recurrence.Item1 = range;
            #endregion

            #region Create the recurring calendar item and extract the Id of an occurrence item
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone);

            OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType();
            occurrenceItemId.ChangeKey         = item.Items.Items[0].ItemId.ChangeKey;
            occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id;
            occurrenceItemId.InstanceIndex     = this.InstanceIndex;
            #endregion

            #region Copy one occurrence of the recurring calendar item
            DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
            folderId.Id = DistinguishedFolderIdNameType.drafts;
            TargetFolderIdType targetFolderId = new TargetFolderIdType();
            targetFolderId.Item = folderId;

            MoveItemType moveItemRequest = new MoveItemType();
            moveItemRequest.ItemIds    = new BaseItemIdType[] { occurrenceItemId };
            moveItemRequest.ToFolderId = targetFolderId;
            MoveItemResponseType response = this.MTGSAdapter.MoveItem(moveItemRequest);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1228");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1228
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Error,
                response.ResponseMessages.Items[0].ResponseClass,
                1228,
                @"[In Messages] If the request is unsuccessful, the MoveItem operation returns a MoveItemResponse element with the ResponseClass attribute of the MoveItemResponseMessage element set to ""Error"". ");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1231");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1231
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence,
                response.ResponseMessages.Items[0].ResponseCode,
                1231,
                @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item.");
            #endregion

            #region Clean up organizer's calendar folders.
            this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>()
            {
                DistinguishedFolderIdNameType.calendar
            });
            #endregion
        }
コード例 #20
0
        public void MSOXWSCORE_S03_TC03_MoveDistributionListsItemSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST");

            #region Step 1: Create the distribution list type item.
            DistributionListType item           = new DistributionListType();
            ItemIdType[]         createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Move the distribution list type item.
            // Clear ExistItemIds for MoveItem.
            this.InitializeCollection();

            // Call MoveItem operation.
            MoveItemResponseType moveItemResponse = this.CallMoveItemOperation(DistinguishedFolderIdNameType.inbox, createdItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);

            ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);

            // One moved distribution list type item should be returned.
            Site.Assert.AreEqual <int>(
                1,
                movedItemIds.GetLength(0),
                "One moved distribution list type item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                movedItemIds.GetLength(0));
            #endregion

            #region Step 3: Get the created distribution list type item failed.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Error,
                getItemResponse.ResponseMessages.Items[0].ResponseClass,
                string.Format(
                    "Get distribution list type item operation should be failed with error! Actual response code: {0}",
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion

            #region Step 4: Get the moved distribution list type item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(movedItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One distribution list type item should be returned.
            Site.Assert.AreEqual <int>(
                1,
                getItemIds.GetLength(0),
                "One distribution list type item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemIds.GetLength(0));

            #endregion
        }
コード例 #21
0
        public void MSOXWSCORE_S07_TC03_MoveTaskItemSuccessfully()
        {
            #region Step 1: Create the task item.
            TaskType     item           = new TaskType();
            ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Move the task item.
            // Clear ExistItemIds for MoveItem.
            this.InitializeCollection();

            // Call MoveItem operation.
            MoveItemResponseType moveItemResponse = this.CallMoveItemOperation(DistinguishedFolderIdNameType.inbox, createdItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);

            ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);

            // One moved task item should be returned.
            Site.Assert.AreEqual <int>(
                1,
                movedItemIds.GetLength(0),
                "One moved task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                movedItemIds.GetLength(0));
            #endregion

            #region Step 3: Get the created task item failed.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Error,
                getItemResponse.ResponseMessages.Items[0].ResponseClass,
                string.Format(
                    "Get task item operation should be failed with error! Actual response code: {0}",
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion

            #region Step 4: Get the moved task item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(movedItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One task item should be returned.
            Site.Assert.AreEqual <int>(
                1,
                getItemIds.GetLength(0),
                "One task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemIds.GetLength(0));

            #endregion
        }
コード例 #22
0
        /// <summary>
        /// Verify the WSDL port type specifications for the MoveItem operation and MoveItemResponseType structure. 
        /// </summary>
        /// <param name="moveItemResponse">The response got from server via MoveItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyMoveItemOperation(MoveItemResponseType moveItemResponse, bool isSchemaValidated)
        {
            // If the validation event return any error or warning, the schema validation is false, 
            // which indicates the schema is not matched with the expected result. 
            // So this requirement can be verified when the isSchemaValidation is true.

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R157");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R157            
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                157,
                @"[In MoveItem] The following is the WSDL port type specification of the MoveItem operation. <wsdl:operation name=""MoveItem"">
    <wsdl:input message=""tns:MoveItemSoapIn"" />
    <wsdl:output message=""tns:MoveItemSoapOut"" />
</wsdl:operation>");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R159");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R159     
            Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                159,
                @"[In MoveItem] The following is the WSDL binding specification of the MoveItem operation. <wsdl:operation name=""MoveItem"">
    <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/MoveItem"" />
    <wsdl:input>
        <soap:header message=""tns:MoveItemSoapIn"" part=""Impersonation"" use=""literal""/>
        <soap:header message=""tns:MoveItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
        <soap:header message=""tns:MoveItemSoapIn"" part=""RequestVersion"" use=""literal""/>
        <soap:body parts=""request"" use=""literal"" />
    </wsdl:input>
    <wsdl:output>
        <soap:body parts=""MoveItemResult"" use=""literal"" />
        <soap:header message=""tns:MoveItemSoapOut"" part=""ServerVersion"" use=""literal""/>
    </wsdl:output>
</wsdl:operation>");

            ItemInfoResponseMessageType item = moveItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;
            if (item.Items.Items[0] is MessageType)
            {
                MessageType messageItem = item.Items.Items[0] as MessageType;
                this.VerifyMessageType(messageItem, isSchemaValidated);
            }
        }
コード例 #23
0
        public void MSOXWSMSG_S04_TC01_MoveMessage()
        {
            #region Create message
            CreateItemType         createItemRequest  = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts);
            CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest);
            Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);

            // Save the ItemId of message responseMessageItem got from the createItem response.
            ItemIdType itemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            itemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;
            #endregion

            #region Move message
            MoveItemType moveItemRequest = new MoveItemType
            {
                ItemIds = new ItemIdType[]
                {
                    itemIdType
                },

                // Set target folder to junk email folder.
                ToFolderId = new TargetFolderIdType
                {
                    Item = new DistinguishedFolderIdType
                    {
                        Id = DistinguishedFolderIdNameType.junkemail
                    }
                }
            };

            MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(moveItemResponse), @"Server should return success for moving the email messages.");
            this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse);
            this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0);
            Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null.");
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null.");

            // Save the ItemId of message responseMessageItem got from the moveItem response.
            ItemIdType moveItemIdType = new ItemIdType();
            Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null.");
            moveItemIdType.Id        = this.firstItemOfFirstInfoItem.ItemId.Id;
            moveItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey;

            // Verify whether the message is moved to junkemail folder.
            string userName         = Common.GetConfigurationPropertyValue("Sender", this.Site);
            string password         = Common.GetConfigurationPropertyValue("SenderPassword", this.Site);
            string domain           = Common.GetConfigurationPropertyValue("Domain", this.Site);
            bool   findItemInDrafts = this.IsItemAvailableAfterMoveOrDelete(userName, password, domain, "drafts", this.Subject, "itemSubject");
            Site.Assert.IsFalse(findItemInDrafts, "The item should not be found in the drafts folder of Sender.");

            bool findItemInJunkemail = this.SearchItems(Role.Sender, "junkemail", this.Subject, "itemSubject");
            Site.Assert.IsTrue(findItemInJunkemail, "The item should be found in the junkemail folder of Sender.");

            #region Verify the requirements about MoveItem
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R161");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R161
            Site.CaptureRequirementIfIsNotNull(
                moveItemResponse,
                161,
                @"[In MoveItem] The protocol client sends a MoveItemSoapIn request WSDL message, and the protocol server responds with a MoveItemSoapOut response WSDL message.");

            Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R162");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R162
            Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                this.infoItems[0].ResponseClass,
                162,
                @"[In MoveItem] If the MoveItem WSDL operation request is successful, the server returns a MoveItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.7.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". ");

            Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R163");

            // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R163
            Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                this.infoItems[0].ResponseCode,
                163,
                @"[In MoveItem] [A successful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element is set to ""NoError"". ");
            #endregion
            #endregion

            #region Delete the moved message
            DeleteItemType deleteItemRequest = new DeleteItemType
            {
                ItemIds = new ItemIdType[]
                {
                    moveItemIdType
                }
            };

            DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest);
            Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages.");
            #endregion
        }
コード例 #24
0
        /// <summary>
        /// Verify the WSDL port type specifications for the MoveItem operation and MoveItemResponseType structure. 
        /// </summary>
        /// <param name="response">The response message of MoveItem operation.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyMoveItemOperation(MoveItemResponseType response, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema validation should be true.");

            // Verify the WSDL port type specifications for the MoveItem operation
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R457");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R457
            Site.CaptureRequirementIfIsTrue(
             isSchemaValidated,
             457,
             @"[In MoveItem operation] The following is the WSDL port type specification for the MoveItem operation. 
<wsdl:operation name=""MoveItem"">
     <wsdl:input message=""tns:MoveItemSoapIn"" />
     <wsdl:output message=""tns:MoveItemSoapOut"" />
</wsdl:operation>");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R635");

            this.Site.CaptureRequirementIfIsTrue(
                isSchemaValidated,
                635,
                @"[In MoveItem Operation] The following is the WSDL binding specification for the MoveItem operation.
<wsdl:operation name=""MoveItem"">
   <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/MoveItem""/>
   <wsdl:input>
      <soap:header message=""tns:MoveItemSoapIn"" part=""Impersonation"" use=""literal""/>
      <soap:header message=""tns:MoveItemSoapIn"" part=""MailboxCulture"" use=""literal""/>
       <soap:header message=""tns:MoveItemSoapIn"" part=""RequestVersion"" use=""literal""/>
      <soap:body parts=""request"" use=""literal""/>
   </wsdl:input>
   <wsdl:output>
      <soap:body parts=""MoveItemResult"" use=""literal""/>
      <soap:header message=""tns:MoveItemSoapOut"" part=""ServerVersion"" use=""literal""/>
   </wsdl:output>
</wsdl:operation>");

            // Verify calendar related items
            foreach (ResponseMessageType respMsg in response.ResponseMessages.Items)
            {
                if (respMsg.ResponseClass == ResponseClassType.Success)
                {
                    ItemInfoResponseMessageType itemInfo = respMsg as ItemInfoResponseMessageType;

                    // Each ItemInfoResponseMessageType contains one calendar related item for MoveItem operation.
                    ItemType item = itemInfo.Items.Items[0];
                    this.VerifyItemTypeItems(item, isSchemaValidated);
                }
            }
        }