예제 #1
0
        public void MSASCON_S03_TC04_ItemOperations_Status6()
        {
            #region Create a conversation and get the created conversation item
            string           conversationSubject = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem conversationItem    = this.CreateConversation(conversationSubject);
            #endregion

            #region Call ItemOperations command with an invalid ConversationId.
            string conversationId = Convert.ToBase64String(Encoding.Default.GetBytes("NotExistConversationId"));
            ItemOperationsResponse itemOperationResponse = this.ItemOperationsMove(conversationId, User1Information.SentItemsCollectionId, true);

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

            // Verify MS-ASCON requirement: MS-ASCON_R146
            Site.CaptureRequirementIfAreEqual(
                "6",
                itemOperationResponse.ResponseData.Response.Move[0].Status,
                146,
                @"[In Status] [The meaning of status value] 6 [is] Not Found. The conversation [or destination folder] does not exist.");
            #endregion

            #region Call ItemOperations command with an invalid destination folder id.
            // Create an ItemOperations request and set an invalid destination folder id.
            itemOperationResponse = this.ItemOperationsMove(conversationItem.ConversationId, "NotExistFolderId", true);

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

            // Verify MS-ASCON requirement: MS-ASCON_R317
            Site.CaptureRequirementIfAreEqual(
                "6",
                itemOperationResponse.ResponseData.Response.Move[0].Status,
                317,
                @"[In Status] [The meaning of status value 6 is] Not Found. The [conversation or] destination folder does not exist.");
            #endregion
        }
예제 #2
0
        /// <summary>
        /// This method is used to verify requirements related to ItemOperations command.
        /// </summary>
        /// <param name="itemOperationsResponse">The ItemOperations command response returned from the server.</param>
        private void VerifyItemOperationsCommandResponse(ItemOperationsResponse itemOperationsResponse)
        {
            // If the schema validation is successful, then following requirements can be captured.
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "Schema validation should be successful.");

            if (itemOperationsResponse.ResponseData.Response.Move != null && itemOperationsResponse.ResponseData.Response.Move.Length != 0)
            {
                foreach (Response.ItemOperationsResponseMove move in itemOperationsResponse.ResponseData.Response.Move)
                {
                    bool isVerifiedR126 = move.ConversationId != null && move.Status != null;

                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R126");
                    Site.Log.Add(LogEntryKind.Debug, "The ConversationId element is: {0}.", move.ConversationId);
                    Site.Log.Add(LogEntryKind.Debug, "The Status element is: {0}.", move.Status);

                    // Verify MS-ASCON requirement: MS-ASCON_R126
                    // The ConversationId element and Status element are not null, so this requirement can be captured.
                    Site.CaptureRequirementIfIsTrue(
                        isVerifiedR126,
                        126,
                        @"[In Move] It [itemoperations:Move element ] has the following child elements:
itemoperations:ConversationId (section 2.2.2.3.1)
itemoperations:Status (section 2.2.2.10).");

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

                    // Verify MS-ASCON requirement: MS-ASCON_R69
                    // The ConversationId element is not null, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNotNull(
                        move.ConversationId,
                        69,
                        @"[In ConversationId (ItemOperations)] In an ItemOperations command response, the itemoperations:ConversationId is a required child element of the itemoperations:Move element that specifies the conversation ID of the conversation that was moved.");

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

                    // Verify MS-ASCON requirement: MS-ASCON_R70
                    // The ConversationId element is not null and schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNotNull(
                        move.ConversationId,
                        70,
                        @"[In ConversationId (ItemOperations)] The value of this element [itemoperations:ConversationId] is a byte array, as specified in [MS-ASDTYPE] section 2.6.1.");

                    this.VerifyStringDataType();

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

                    // Verify MS-ASCON requirement: MS-ASCON_R139
                    // The Status element is not null, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNotNull(
                        move.Status,
                        139,
                        @"[In Status] The itemoperations:Status element ([MS-ASCMD] section 2.2.3.162.7) is a required child element of the itemoperations:Move element ([MS-ASCMD] section 2.2.3.107.1) in the ItemOperations command response ([MS-ASCMD] section 2.2.2.8) that specifies the status of the move operation.");

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

                    // Verify MS-ASCON requirement: MS-ASCON_R142
                    // The Status element is not null and schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNotNull(
                        move.Status,
                        142,
                        @"[In Status] The value of this [itemoperations:Status] element is an integer, as specified in [MS-ASDTYPE] section 2.5.");

                    this.VerifyIntegerDataType();
                }
            }
        }
예제 #3
0
        public void MSASCON_S03_TC02_ItemOperations_MoveAlways()
        {
            #region Create a conversation and get the created conversation item
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Move one email in the conversation to Sent Items folder
            Collection <string> idToMove = new Collection <string>();
            idToMove.Add(sourceConversationItem.ServerId[0]);
            this.CallMoveItemsCommand(idToMove, User1Information.InboxCollectionId, User1Information.SentItemsCollectionId);
            #endregion

            #region Call ItemOperations command to move the conversation from Inbox to DeletedItems folder
            ItemOperationsResponse itemOperationResponse = this.ItemOperationsMove(sourceConversationItem.ConversationId, User1Information.DeletedItemsCollectionId, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.SentItemsCollectionId, conversationSubject, false);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.DeletedItemsCollectionId, conversationSubject, false);

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

            // Verify MS-ASCON requirement: MS-ASCON_R143
            Site.CaptureRequirementIfAreEqual(
                "1",
                itemOperationResponse.ResponseData.Response.Move[0].Status,
                143,
                @"[In Status] [The meaning of status value] 1 [is] Success. The server successfully completed the operation.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R216
            // If R143 has been captured and the ConversationId element is not null, then this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                itemOperationResponse.ResponseData.Response.Move[0].ConversationId,
                216,
                @"[In Always Moving a Conversation] The server sends an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) that includes the itemoperations:Status element, as specified in section 2.2.2.10, and the itemoperations:ConversationId element (section 2.2.2.3.1).");
            #endregion

            #region User1 syncs messages in the Inbox folder and Deleted Items folder after conversation moved
            DataStructures.Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "No conversation messages should not be found in Inbox folder.");

            ConversationItem destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count - 1, destinationCoversationItem.ServerId.Count, "All conversation messages except in Sent Items Folder should be moved to Deleted Items folder.");
            #endregion

            #region User2 replies the received message to create a future e-mail message for that conversation.
            this.SwitchUser(this.User2Information, false);
            syncResult = this.SyncEmail(conversationSubject, User2Information.InboxCollectionId, true, null, null);

            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            // Smart reply the received email from User2 to User1.
            this.CallSmartReplyCommand(syncResult.ServerId, User2Information.InboxCollectionId, user2MailboxAddress, user1MailboxAddress, conversationSubject);

            // Switch the current user to User1.
            this.SwitchUser(this.User1Information, false);

            destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId, sourceConversationItem.ServerId.Count + 1);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count, "The future message should be moved to Deleted Items folder.");

            // Check if the received email is in Inbox folder.
            syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "The future message should not be found in Inbox folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                68,
                @"[In ConversationId (ItemOperations)] In an ItemOperations command request ([MS-ASCMD] section 2.2.1.10), the itemoperations:ConversationId element ([MS-ASCMD] section 2.2.3.35.1) is a required child element of the itemoperations:Move element ([MS-ASCMD] section 2.2.3.117.1) that specifies the conversation ID of the conversation that is to be moved.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                118,
                @"[In DstFldId] The itemoperations:DstFldId element ([MS-ASCMD] section 2.2.3.51.1) is a required child element of the itemoperations:Move element ([MS-ASCMD] section 2.2.3.117.1) in an ItemOperations command request ([MS-ASCMD] section 2.2.1.10) that specifies the folder to which the conversation is moved.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                130,
                @"[In MoveAlways] When a conversation is set to always be moved, all e-mail messages in the conversation, including all future e-mail messages in the conversation, are moved from all folders except the Sent Items folder to the destination folder that is specified by the DstFldId element (section 2.2.2.6).");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                166,
                @"[In Ignoring a Conversation] When a conversation is ignored, all e-mail messages in the conversation, including all future e-mail messages for that conversation, are moved from all folders except Sent Items folder to the Deleted Items folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                172,
                @"[In Setting up a Conversation to Be Moved Always] When a conversation is set to be moved always, all e-mail messages in the conversation, including all future e-mail messages for that conversation, are moved from all folders except Sent Items folder to a destination folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                213,
                @"[In Ignoring a Conversation] When the server receives a request to ignore a conversation, as specified in section 3.1.4.4, the server moves all e-mail messages in the conversation, including all future e-mail messages for that conversation, from all folders except Sent Items folder to the Deleted Items folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                215,
                @"[In Always Moving a Conversation] When the server receives a request to always move a conversation, as specified in section 3.1.4.6, the server moves all e-mail messages in the conversation, including all future e-mail messages for that conversation, from all folders except Sent Items folder to the specified destination folder.");
            #endregion
        }
예제 #4
0
        public void MSASDOC_S02_TC01_ItemOperations_WithoutMultipart()
        {
            #region Client calls ItemOperations command to get data of a shared visible document.

            // Build element Fetch.
            ItemOperationsFetch fetchElement = this.FetchElementBuilder(Common.GetConfigurationPropertyValue("SharedVisibleDocument", Site));

            // Create an ItemOperation command request.
            ItemOperationsRequest itemOperationsRequest = Common.CreateItemOperationsRequest(new object[] { fetchElement });

            // Send request and get response.
            ItemOperationsResponse itemOperationResponse = this.ASDOCAdapter.ItemOperations(itemOperationsRequest, DeliveryMethodForFetch.Inline);
            Site.Assert.AreEqual <int>(1, itemOperationResponse.ResponseData.Response.Fetch.Length, "Only one document's information should be returned.");
            Site.Assert.AreEqual <string>("1", itemOperationResponse.ResponseData.Response.Fetch[0].Status, "The call should be successful.");

            #endregion

            // Multipart responses have a Content-Type header with the value "application/vnd.ms-sync.multipart".
            bool isMultiPartResponse = itemOperationResponse.Headers.ToString().Contains("application/vnd.ms-sync.multipart");

            bool existDataElement = false;

            foreach (Response.ItemsChoiceType3 itemsElementName in itemOperationResponse.ResponseData.Response.Fetch[0].Properties.ItemsElementName)
            {
                if (itemsElementName == Response.ItemsChoiceType3.Data)
                {
                    existDataElement = true;
                    break;
                }
            }

            Site.Assert.IsTrue(existDataElement, "itemoperations:Data element should be returned");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASDOC_R69, header value is:{0}", itemOperationResponse.Headers.ToString());

            // Verify MS-ASDOC requirement: MS-ASDOC_R69
            // If itemoperations:Data element is successfully returned, the body has been decoded from base64 encoding.
            Site.CaptureRequirement(
                69,
                @"[In Requesting the Document Body from the Server] The body of the document is returned as [either] text encoded with base64 encoding in the itemoperations:Data element ([MS-ASCMD] section 2.2.3.39.1) of the ItemOperations command response [or as binary data], depending on the content type that the client requested.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASDOC_R77, header value is:{0}", itemOperationResponse.Headers.ToString());

            // Verify MS-ASDOC requirement: MS-ASDOC_R77
            Site.CaptureRequirementIfIsFalse(
                isMultiPartResponse,
                77,
                @"[In ItemOperations Command Request] If this header[the HTTP header (2) MS-ASAcceptMultiPart: T] is not used, the document data is returned as text.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASDOC_R98, header value is:{0}", itemOperationResponse.Headers.ToString());

            // Verify MS-ASDOC requirement: MS-ASDOC_R98
            // If itemoperations:Data element is successfully returned, the body has been decoded from base64 encoding.
            Site.CaptureRequirementIfIsFalse(
                isMultiPartResponse,
                98,
                @"[In Retrieving the Document Body] The server responds with an ItemOperations command response ([MS-ASCMD] section 2.2.2.8), which returns the body of the document as text encoded with base64 encoding in the itemoperations:Data element ([MS-ASCMD] section 2.2.2.8) of the response if the command request was not a multi-part request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASDOC_R107, header value is:{0}", itemOperationResponse.Headers.ToString());

            // Verify MS-ASDOC requirement: MS-ASDOC_R107
            // If itemoperations:Data element is successfully returned, the body has been decoded from base64 encoding.
            Site.CaptureRequirementIfIsFalse(
                isMultiPartResponse,
                107,
                @"[In ItemOperations Command Response] Otherwise[an ItemOperations command request for the body of the document was not made using the MS-ASAcceptMultiPart: T header (2) ], the server MUST transmit the document as data encoded with base64 encoding within the itemoperations:Data element ([MS-ASCMD] section 2.2.3.39.1) of the ItemOperations command response.");
        }