Wrapper class of Sync response
Exemplo n.º 1
0
        public void MSASAIRS_S03_TC01_FileReference_ZeroLengthString()
        {
            #region Send a mail with normal attachment.
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body    = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.NormalAttachment, subject, body);
            #endregion

            #region Send an ItemOperations request with the value of FileReference element as a zero-length string.
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);

            // Send an ItemOperations request with the value of FileReference element as a zero-length string.
            ItemOperationsRequest request = TestSuiteHelper.CreateItemOperationsRequest(this.User2Information.InboxCollectionId, syncItem.ServerId, string.Empty, null, null);

            DataStructures.ItemOperationsStore itemOperationsStore = this.ASAIRSAdapter.ItemOperations(request, DeliveryMethodForFetch.Inline);

            Site.Assert.AreEqual <int>(
                1,
                itemOperationsStore.Items.Count,
                "There should be 1 item in ItemOperations response.");
            #endregion

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

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R214
            Site.CaptureRequirementIfAreEqual <string>(
                "15",
                itemOperationsStore.Items[0].Status,
                214,
                @"[In FileReference (Fetch)] If the client includes a zero-length string for the value of this element [the FileReference (Fetch) element] in an ItemOperations command request, the server responds with a protocol status error of 15.");
            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the specified email item.
        /// </summary>
        /// <param name="emailSubject">The subject of the email item.</param>
        /// <param name="folderCollectionId">The serverId of the default folder.</param>
        /// <param name="bodyPreference">The preference information related to the type and size of information that is returned from fetching.</param>
        /// <returns>The result of getting the specified email item.</returns>
        private SyncStore GetSyncResult(string emailSubject, string folderCollectionId, Request.BodyPreference bodyPreference)
        {
            SyncStore syncItemResult;

            Microsoft.Protocols.TestSuites.Common.DataStructures.Sync item = null;
            int counter    = 0;
            int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));

            do
            {
                Thread.Sleep(waitTime);

                // Get the new added email item
                syncItemResult = this.SyncChanges(this.GetInitialSyncKey(folderCollectionId), folderCollectionId, bodyPreference);
                if (syncItemResult != null && syncItemResult.CollectionStatus == 1)
                {
                    item = TestSuiteHelper.GetSyncAddItem(syncItemResult, emailSubject);
                }

                counter++;
            }while ((syncItemResult == null || item == null) && counter < retryCount);

            Site.Assert.IsNotNull(item, "The email item with subject {0} should be found. Retry count: {1}", emailSubject, counter);

            // Verify sync result
            Site.Assert.AreEqual <byte>(
                1,
                syncItemResult.CollectionStatus,
                "If the Sync command executes successfully, the status in response should be 1.");

            return(syncItemResult);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the specified email item from the sync add response by using the subject.
        /// </summary>
        /// <param name="syncStore">The sync result.</param>
        /// <param name="subject">The email subject.</param>
        /// <returns>Return the specified email item.</returns>
        internal static DataStructures.Sync GetSyncAddItem(DataStructures.SyncStore syncStore, string subject)
        {
            DataStructures.Sync item = null;

            if (syncStore.AddElements != null)
            {
                foreach (DataStructures.Sync syncItem in syncStore.AddElements)
                {
                    if (syncItem.Email.Subject == subject)
                    {
                        item = syncItem;
                        break;
                    }

                    if (syncItem.Calendar.Subject == subject)
                    {
                        item = syncItem;
                        break;
                    }

                    if (syncItem.Contact.FileAs == subject)
                    {
                        item = syncItem;
                        break;
                    }
                }
            }

            return(item);
        }
Exemplo n.º 4
0
        public void MSASCON_S05_TC03_Search_Status164()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            if (Common.IsRequirementEnabled(220, this.Site))
            {
                #region Call Search command with BodyPartPreference element and set the Type element to 3
                this.SwitchUser(this.User1Information, false);

                DataStructures.Sync syncItem           = this.SyncEmail(subject, User1Information.InboxCollectionId, true, null, null);
                BodyPartPreference  bodyPartPreference = new BodyPartPreference()
                {
                    Type = 3,
                };

                SearchRequest searchRequest            = TestSuiteHelper.GetSearchRequest(syncItem.Email.ConversationId, bodyPartPreference, null);
                DataStructures.SearchStore searchStore = this.CONAdapter.Search(searchRequest, false, 0);
                this.VerifyMessagePartStatus164(byte.Parse(searchStore.StoreStatus));
                #endregion
            }
        }
Exemplo n.º 5
0
        public void MSASCON_S03_TC07_ItemOperations_Status164()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call ItemOperations command with BodyPartPreference element and set the Type element to 3
            this.SwitchUser(this.User1Information, false);

            DataStructures.Sync syncItem           = this.SyncEmail(subject, User1Information.InboxCollectionId, true, null, null);
            BodyPartPreference  bodyPartPreference = new BodyPartPreference()
            {
                Type = 3,
            };

            ItemOperationsRequest  itemOperationsRequest  = TestSuiteHelper.GetItemOperationsRequest(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, null);
            ItemOperationsResponse itemOperationsResponse = this.CONAdapter.ItemOperations(itemOperationsRequest);
            Site.Assert.AreEqual("1", itemOperationsResponse.ResponseData.Status, "The ItemOperations operation should be success.");
            this.VerifyMessagePartStatus164(byte.Parse(itemOperationsResponse.ResponseData.Response.Fetch[0].Status));
            #endregion
        }
Exemplo n.º 6
0
        /// <summary>
        /// Synchronize item with specified subject.
        /// </summary>
        /// <param name="subject">The subject of the item.</param>
        /// <param name="collectionId">The collection id which to sync with.</param>
        /// <param name="commands">The sync commands.</param>
        /// <param name="bodyPreferences">The bodyPreference in the options element.</param>
        /// <param name="bodyPartPreferences">The bodyPartPreference in the options element.</param>
        /// <returns>The item with specified subject.</returns>
        protected DataStructures.Sync GetSyncResult(string subject, string collectionId, object[] commands, Request.BodyPreference[] bodyPreferences, Request.BodyPartPreference[] bodyPartPreferences)
        {
            DataStructures.SyncStore syncStore;
            DataStructures.Sync      item = null;
            SyncRequest request           = TestSuiteHelper.CreateSyncRequest(this.GetInitialSyncKey(collectionId), collectionId, commands, bodyPreferences, bodyPartPreferences);

            int counter    = 0;
            int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));

            do
            {
                Thread.Sleep(waitTime);
                syncStore = this.ASAIRSAdapter.Sync(request);
                if (syncStore != null && syncStore.CollectionStatus == 1)
                {
                    item = TestSuiteHelper.GetSyncAddItem(syncStore, subject);
                }

                counter++;
            }while ((syncStore == null || item == null) && counter < retryCount);

            this.Site.Assert.IsNotNull(item, "The email item with subject {0} should be found, retry count: {1}.", subject, counter);

            this.SyncKey = syncStore.SyncKey;

            return(item);
        }
        public void MSASTASK_S03_TC02_RetrieveInvalidTaskItemWithSearch()
        {
            #region Call Sync command to create a task item

            Dictionary <Request.ItemsChoiceType8, object> taskItem = new Dictionary <Request.ItemsChoiceType8, object>();
            string subject = Common.GenerateResourceName(Site, "subject");
            taskItem.Add(Request.ItemsChoiceType8.Subject2, subject);

            #endregion

            #region Call Sync command to add the task to the server

            // add task
            SyncStore syncResponse = this.SyncAddTask(taskItem);
            Site.Assert.AreEqual <int>(1, int.Parse(syncResponse.AddResponses[0].Status), "Adding a task item to server should success.");
            SyncItem task = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);
            Site.Assert.IsNotNull(task.Task, "The task which subject is {0} should exist in server.", subject);
            ItemsNeedToDelete.Add(subject);

            #endregion

            #region Call Search command to search task on the server

            // Send a string create task item request without Type element contains in Recurrence.
            SendStringResponse sendStringResponse = this.TASKAdapter.SendStringRequest("<Search xmlns=\"Search\"><Store><Name>Mailbox</Name><Query><And><Class xmlns=\"AirSync\">Tasks</Class><CollectionId xmlns=\"AirSync\">" + this.UserInformation.TasksCollectionId + "</CollectionId><FreeText>FreeText</FreeText><Subject xmlns=\"Tasks\">user</Subject></And></Query><Options><DeepTraversal /></Options></Store></Search>", CommandName.Search);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(sendStringResponse.ResponseDataXML);
            XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
            xnm.AddNamespace("e", "Search");

            int     retryCount   = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
            int     waitTime     = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int     counter      = 1;
            XmlNode searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm);

            while (counter < retryCount && searchStatus != null && searchStatus.InnerXml.Equals("10"))
            {
                Thread.Sleep(waitTime);
                sendStringResponse = this.TASKAdapter.SendStringRequest("<Search xmlns=\"Search\"><Store><Name>Mailbox</Name><Query><And><Class xmlns=\"AirSync\">Tasks</Class><CollectionId xmlns=\"AirSync\">" + this.UserInformation.TasksCollectionId + "</CollectionId><FreeText>FreeText</FreeText><Subject xmlns=\"Tasks\">user</Subject></And></Query><Options><DeepTraversal /></Options></Store></Search>", CommandName.Search);
                doc.LoadXml(sendStringResponse.ResponseDataXML);
                xnm = new XmlNamespaceManager(doc.NameTable);
                xnm.AddNamespace("e", "Search");
                searchStatus = doc.SelectSingleNode("/e:Search/e:Status", xnm);
                counter++;
            }
            #endregion

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R364
            Site.CaptureRequirementIfAreEqual <string>(
                "2",
                Common.GetSearchStatusCode(sendStringResponse),
                364,
                @"[In Search Command Response] If elements that belong to the Task class are included in a Search command request, the server MUST return a Status value of 2 in the Store element, as specified in [MS-ASCMD] section 2.2.3.162.12.");
        }
Exemplo n.º 8
0
        public void MSASCON_S03_TC01_ItemOperations_Ignore()
        {
            #region Create a conversation and get the created conversation item
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Call ItemOperations command to ignore the conversation
            // Move the created conversation from Inbox folder to Deleted Items folder with setting MoveAlways element.
            ItemOperationsResponse itemOperationResponse = this.ItemOperationsMove(sourceConversationItem.ConversationId, User1Information.DeletedItemsCollectionId, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.DeletedItemsCollectionId, conversationSubject, false);

            bool isVerifiedR214 = itemOperationResponse.ResponseData.Response.Move[0].Status != null && itemOperationResponse.ResponseData.Response.Move[0].ConversationId != null;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R214");
            Site.Log.Add(LogEntryKind.Debug, "The value of the Status element is {0}, and the value of ConversationId element is {1}.", itemOperationResponse.ResponseData.Response.Move[0].Status, itemOperationResponse.ResponseData.Response.Move[0].ConversationId);

            // Verify MS-ASCON requirement: MS-ASCON_R214
            Site.CaptureRequirementIfIsTrue(
                isVerifiedR214,
                214,
                @"[In Ignoring 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).");

            Site.Assert.AreEqual("1", itemOperationResponse.ResponseData.Response.Move[0].Status, "The move operation should be success.");
            #endregion

            #region User1 synchronizes 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, destinationCoversationItem.ServerId.Count, "All conversation messages 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 + 1, 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.");
            #endregion
        }
Exemplo n.º 9
0
        public void MSASCON_S04_TC01_MoveItems_Move()
        {
            #region Create a conversation and get the created conversation item.
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Call MoveItems command to move the conversation from Inbox folder to SentItems folder.
            MoveItemsResponse moveItemsResponse = this.CallMoveItemsCommand(sourceConversationItem.ServerId, User1Information.InboxCollectionId, User1Information.SentItemsCollectionId);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.SentItemsCollectionId, conversationSubject, false);

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

            // Verify MS-ASCON requirement: MS-ASCON_R218
            Site.CaptureRequirementIfIsNotNull(
                moveItemsResponse.ResponseData,
                218,
                @"[In Processing a MoveItems Command] The server sends a MoveItems command response, as specified in [MS-ASCMD] section 2.2.1.12.");
            #endregion

            #region Synchronize emails in the Inbox folder and Sent Items folder after conversation moved.
            // Call Sync command to get the emails of the conversation in Inbox folder.
            DataStructures.Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);

            // Get the emails of the conversation in Sent Items folder.
            ConversationItem destinationCoversationItem = this.GetConversationItem(User1Information.SentItemsCollectionId, sourceConversationItem.ConversationId);

            // If the emails of the conversation in Inbox folder could not be found and the emails count of the conversation in Sent Items folder is equal to Inbox folder, then the original emails have been moved.
            bool allEmailsMoved = syncResult == null && sourceConversationItem.ServerId.Count == destinationCoversationItem.ServerId.Count;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R170");
            Site.Log.Add(LogEntryKind.Debug, "The count of the emails of the specified conversation in Inbox folder is {0}, while it is {1} in Sent Items folder.", sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R170
            Site.CaptureRequirementIfIsTrue(
                allEmailsMoved,
                170,
                @"[In Moving a Conversation from the Current Folder] When a conversation is moved from the current folder to another folder, all e-mail messages that are in the conversation are moved from the current folder to the destination folder.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R217");
            Site.Log.Add(LogEntryKind.Debug, "The count of the emails of the specified conversation in Inbox folder is {0}, while it is {1} in Sent Items folder.", sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R217
            Site.CaptureRequirementIfIsTrue(
                allEmailsMoved,
                217,
                @"[In Processing a MoveItems Command] When the server receives a request to move a conversation, as specified in section 3.1.4.5, the server moves all e-mail messages that are in the conversation from the current folder to the specified destination folder.");
            #endregion
        }
Exemplo n.º 10
0
        /// <summary>
        /// Find an email with specific subject and folder.
        /// </summary>
        /// <param name="subject">The subject of the email item.</param>
        /// <param name="collectionId">Identify the folder as the collection being synchronized.</param>
        /// <param name="rightsManagementSupport">A boolean value specifies whether the server will decompress and decrypt rights-managed email messages before sending them to the client or not</param>
        /// <param name="isRetryNeeded">A boolean value specifies whether need retry.</param>
        /// <returns>Return change result</returns>
        protected DataStructures.Sync SyncEmail(string subject, string collectionId, bool?rightsManagementSupport, bool isRetryNeeded)
        {
            SyncRequest syncRequest = Common.CreateInitialSyncRequest(collectionId);

            DataStructures.SyncStore initSyncResult = this.ASRMAdapter.Sync(syncRequest);

            // Verify sync change result
            this.Site.Assert.AreEqual <byte>(1, initSyncResult.CollectionStatus, "If the Sync command executes successfully, the Status in response should be 1.");

            syncRequest = TestSuiteHelper.CreateSyncRequest(initSyncResult.SyncKey, collectionId, rightsManagementSupport);
            DataStructures.Sync sync = this.ASRMAdapter.SyncEmail(syncRequest, subject, isRetryNeeded);
            return(sync);
        }
Exemplo n.º 11
0
        public void MSASAIRS_S03_TC02_NormalAttachment()
        {
            #region Send a mail with normal attachment
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body    = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.NormalAttachment, subject, body);
            #endregion

            #region Verify requirements
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);
            this.VerifyMethodElementValue(syncItem.Email, 1);

            DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null);
            this.VerifyMethodElementValue(itemOperationsItem.Email, 1);

            if (Common.IsRequirementEnabled(53, this.Site))
            {
                DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, null, null, null);
                this.VerifyMethodElementValue(searchItem.Email, 1);
            }

            // According to above steps, requirement MS-ASAIRS_R225 can be captured directly
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R225");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R225
            Site.CaptureRequirement(
                225,
                @"[In Method (Attachment)] [The value] 1 [of the Method element] meaning ""Normal attachment"" specifies that the attachment is a normal attachment.");

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

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R160
            Site.CaptureRequirementIfIsNotNull(
                ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).ContentId,
                160,
                @"[In ContentId (Attachment)] The ContentId element is an optional child element of the Attachment element (section 2.2.2.7) that contains the unique object ID for an attachment.");

            this.Site.CaptureRequirementIfIsNotNull(
                ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).ContentId,
                1343,
                @"[In ContentId (Attachment)] [The ContentId element is an optional child element of the Attachment element (section 2.2.2.7) that contains the unique identifier of the attachment, and] is used to reference the attachment within the item to which the attachment belongs.");

            #endregion
        }
Exemplo n.º 12
0
        /// <summary>
        /// Get the non-truncated item data.
        /// </summary>
        /// <param name="subject">The subject of the item.</param>
        /// <param name="collectionId">The server id of the folder which contains the specified item.</param>
        /// <returns>The item with non-truncated data.</returns>
        protected DataStructures.Sync GetAllContentItem(string subject, string collectionId)
        {
            Request.BodyPartPreference[] bodyPartPreference = null;

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") &&
                !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0"))
            {
                // Set the BodyPartPreference element to retrieve the BodyPart element in response
                bodyPartPreference = new Request.BodyPartPreference[]
                {
                    new Request.BodyPartPreference()
                    {
                        Type = 2
                    }
                };
            }

            // Set the BodyPreference element to retrieve the Body element in response
            Request.BodyPreference[] bodyPreference = new Request.BodyPreference[]
            {
                new Request.BodyPreference()
                {
                    Type = 1
                }
            };

            // Get the item with specified subject
            DataStructures.Sync item = this.GetSyncResult(subject, collectionId, null, bodyPreference, bodyPartPreference);

            this.Site.Assert.IsNotNull(item.Email.Body, "The Body element should be included in Sync command response when the BodyPreference element is specified in Sync command request.");

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") &&
                !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0"))
            {
                this.Site.Assert.IsNotNull(
                    item.Email.BodyPart,
                    "The BodyPart element should be included in Sync command response when the BodyPartPreference element is specified in Sync command request.");

                this.Site.Assert.AreEqual <byte>(
                    1,
                    item.Email.BodyPart.Status,
                    "The Status should be 1 to indicate the success of the Sync command response in returning Data element content given the BodyPartPreference element settings in the Sync command request.");
            }

            return(item);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Get the specified email item from the Sync Change response by using the subject.
        /// </summary>
        /// <param name="syncStore">The Sync result.</param>
        /// <param name="fileAs">The contact FileAs.</param>
        /// <returns>Return the specified email item.</returns>
        internal static DataStructures.Sync GetSyncChangeItem(DataStructures.SyncStore syncStore, string fileAs)
        {
            DataStructures.Sync item = null;

            if (syncStore.ChangeElements.Count != 0)
            {
                foreach (DataStructures.Sync syncItem in syncStore.ChangeElements)
                {
                    if (syncItem.Contact.FileAs == fileAs)
                    {
                        item = syncItem;
                        break;
                    }
                }
            }

            return(item);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Get the specified task item from the sync change response.
        /// </summary>
        /// <param name="collectionId">The task folder server id.</param>
        /// <param name="taskSubject">The subject value of task.</param>
        /// <returns>Return the specified task item.</returns>
        public SyncItem GetChangeItem(string collectionId, string taskSubject)
        {
            SyncItem resultItem = null;

            if (collectionId == this.UserInformation.TasksCollectionId)
            {
                // Get the server changes through sync command.
                SyncStore syncResponse = this.SyncChanges(collectionId);

                foreach (SyncItem item in syncResponse.AddElements)
                {
                    if (item.Task.Subject == taskSubject)
                    {
                        resultItem = item;
                        break;
                    }
                }
            }

            return(resultItem);
        }
Exemplo n.º 15
0
        public void MSASAIRS_S03_TC03_EmbeddedMessageAttachment()
        {
            #region Send a mail with an e-mail messsage attachment
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body    = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.EmbeddedAttachment, subject, body);
            #endregion

            #region Verify requirements
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);
            this.VerifyMethodElementValue(syncItem.Email, 5);

            DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null);
            this.VerifyMethodElementValue(itemOperationsItem.Email, 5);

            if (Common.IsRequirementEnabled(53, this.Site))
            {
                DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, itemOperationsItem.Email.ConversationId, null, null);
                this.VerifyMethodElementValue(searchItem.Email, 5);
            }

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

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R2299
            Site.CaptureRequirementIfIsTrue(
                ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).DisplayName.EndsWith(".eml", System.StringComparison.CurrentCultureIgnoreCase),
                2299,
                @"[In Method (Attachment)] [The value] 5 [of the Method element] meaning ""Embedded message"" indicates that the attachment is an e-mail message, and that the attachment file has an .eml extension.");

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

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R100298
            Site.CaptureRequirementIfIsFalse(
                ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).IsInlineSpecified,
                100298,
                @"[In IsInline (Attachment)] If the value[IsInline] is FALSE, then the attachment is not embedded in the message.");
            #endregion
        }
Exemplo n.º 16
0
        public void MSASAIRS_S03_TC04_OLEAttachment()
        {
            #region Send a mail with an embedded OLE object
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body    = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.AttachOLE, subject, body);
            #endregion

            #region Verify requirements
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);
            this.VerifyMethodElementValue(syncItem.Email, 6);

            DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null);
            this.VerifyMethodElementValue(itemOperationsItem.Email, 6);

            if (Common.IsRequirementEnabled(53, this.Site))
            {
                DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, itemOperationsItem.Email.ConversationId, null, null);
                this.VerifyMethodElementValue(searchItem.Email, 6);
            }

            // According to above steps, requirement MS-ASAIRS_R230 can be captured directly
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R230");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R230
            Site.CaptureRequirement(
                230,
                @"[In Method (Attachment)] [The value] 6 [of the Method element] meaning ""Attach OLE"" indicates that the attachment is an embedded Object Linking and Embedding (OLE) object, such as an inline image.");

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

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R100299
            Site.CaptureRequirementIfIsTrue(
                ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).IsInline,
                100299,
                @"[In IsInline (Attachment)] If the value[IsInline] is TRUE, then the attachment is embedded in the message.");
            #endregion
        }
Exemplo n.º 17
0
        public void MSASAIRS_S05_TC01_Location()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command with Add element to add an appointment to the server
            Request.SyncCollectionAddApplicationData applicationData = new Request.SyncCollectionAddApplicationData();

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType8> itemsElementName = new List <Request.ItemsChoiceType8>();

            string subject = Common.GenerateResourceName(Site, "Subject");
            items.Add(subject);
            itemsElementName.Add(Request.ItemsChoiceType8.Subject);

            // MeetingStauts is set to 0, which means it is an appointment with no attendees.
            byte meetingStatus = 0;
            items.Add(meetingStatus);
            itemsElementName.Add(Request.ItemsChoiceType8.MeetingStatus);

            Request.Location location = new Request.Location();
            location.Accuracy                  = (double)1;
            location.AccuracySpecified         = true;
            location.Altitude                  = (double)55.46;
            location.AltitudeAccuracy          = (double)1;
            location.AltitudeAccuracySpecified = true;
            location.AltitudeSpecified         = true;
            location.Annotation                = "Location sample annotation";
            location.City               = "Location sample city";
            location.Country            = "Location sample country";
            location.DisplayName        = "Location sample dislay name";
            location.Latitude           = (double)11.56;
            location.LatitudeSpecified  = true;
            location.LocationUri        = "Location Uri";
            location.Longitude          = (double)1.9;
            location.LongitudeSpecified = true;
            location.PostalCode         = "Location sample postal code";
            location.State              = "Location sample state";
            location.Street             = "Location sample street";
            items.Add(location);
            itemsElementName.Add(Request.ItemsChoiceType8.Location1);

            applicationData.Items            = items.ToArray();
            applicationData.ItemsElementName = itemsElementName.ToArray();
            SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncAddRequest(this.GetInitialSyncKey(this.User1Information.CalendarCollectionId), this.User1Information.CalendarCollectionId, applicationData);

            DataStructures.SyncStore syncAddResponse = this.ASAIRSAdapter.Sync(syncAddRequest);
            Site.Assert.IsTrue(syncAddResponse.AddResponses[0].Status.Equals("1"), "The sync add operation should be success; It is:{0} actually", syncAddResponse.AddResponses[0].Status);

            // Add the appointment to clean up list.
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject);
            #endregion

            #region Call Sync command to get the new added calendar item.
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion

            #region Call ItemOperations command to reterive the added calendar item.
            this.GetItemOperationsResult(this.User1Information.CalendarCollectionId, syncItem.ServerId, null, null, null, null);
            #endregion

            #region Call Search command to search the added calendar item.
            this.GetSearchResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion
        }
Exemplo n.º 18
0
        public void MSASCON_S03_TC08_ItemOperations_MessagePart()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string body                = Common.GenerateResourceName(Site, "Body");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, body);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call ItemOperations command without BodyPreference or BodyPartPreference element.
            this.SwitchUser(this.User1Information, false);

            // Get all of the email BodyPart data.
            BodyPartPreference bodyPartPreference = new BodyPartPreference()
            {
                Type = 2,
            };

            DataStructures.Sync syncItem        = this.SyncEmail(subject, User1Information.InboxCollectionId, true, bodyPartPreference, null);
            XmlElement          lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string allData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);

            DataStructures.Email email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, null);
            this.VerifyMessagePartWithoutPreference(email);

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

            // Verify MS-ASCON requirement: MS-ASCON_R340
            Site.CaptureRequirementIfIsNull(
                email.BodyPart,
                340,
                @"[In Sending a Message Part] The airsyncbase:BodyPart element is not present in the [ItemOperations command] response if the client did not request the message part, as specified in section 3.1.4.10.");
            #endregion

            #region Call ItemOperations command with only BodyPreference element.
            BodyPreference bodyPreference = new BodyPreference()
            {
                Type = 2,
            };

            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference);
            this.VerifyMessagePartWithBodyPreference(email);
            #endregion

            #region Call ItemOperations command with only BodyPartPreference element.
            bodyPartPreference = new BodyPartPreference()
            {
                Type                    = 2,
                TruncationSize          = 12,
                TruncationSizeSpecified = true,
            };

            email           = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, null);
            lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string truncatedData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);
            this.VerifyMessagePartWithBodyPartPreference(email, truncatedData, allData, (int)bodyPartPreference.TruncationSize);

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

            // Verify MS-ASCON requirement: MS-ASCON_R236
            Site.CaptureRequirementIfIsNotNull(
                email.BodyPart,
                236,
                @"[In Sending a Message Part] If the client [Sync command request ([MS-ASCMD] section 2.2.1.21), Search command request ([MS-ASCMD] section 2.2.1.16) or] ItemOperations command request 9([MS-ASCMD] section 2.2.1.10) includes the airsyncbase:BodyPartPreference element (section 2.2.2.2), then the server uses the airsyncbase:BodyPart element (section 2.2.2.1) to encapsulate the message part in the response.");

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

            // A message part and its meta-data are encapsulated by BodyPart element in the ItemOperation response, so this requirement can be captured.
            Site.CaptureRequirement(
                39,
                @"[In BodyPart] The airsyncbase:BodyPart element ([MS-ASAIRS] section 2.2.2.10) encapsulates a message part and its meta-data in [a Sync command response ([MS-ASCMD] section 2.2.1.21),] an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) [or a Search command response ([MS-ASCMD] section 2.2.1.16)].");
            #endregion

            #region Call ItemOperations command with both BodyPreference and BodyPartPreference elements.
            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, bodyPreference);
            this.VerifyMessagePartWithBothPreference(email);
            #endregion
        }
Exemplo n.º 19
0
        public void MSASAIRS_S05_TC01_Location()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command with Add element to add an appointment to the server
            Request.SyncCollectionAddApplicationData applicationData = new Request.SyncCollectionAddApplicationData();

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType8> itemsElementName = new List <Request.ItemsChoiceType8>();

            string subject = Common.GenerateResourceName(Site, "Subject");
            items.Add(subject);
            itemsElementName.Add(Request.ItemsChoiceType8.Subject);

            // MeetingStauts is set to 0, which means it is an appointment with no attendees.
            byte meetingStatus = 0;
            items.Add(meetingStatus);
            itemsElementName.Add(Request.ItemsChoiceType8.MeetingStatus);

            Request.Location location = new Request.Location();
            location.Accuracy                  = (double)1;
            location.AccuracySpecified         = true;
            location.Altitude                  = (double)55.46;
            location.AltitudeAccuracy          = (double)1;
            location.AltitudeAccuracySpecified = true;
            location.AltitudeSpecified         = true;
            location.Annotation                = "Location sample annotation";
            location.City               = "Location sample city";
            location.Country            = "Location sample country";
            location.DisplayName        = "Location sample dislay name";
            location.Latitude           = (double)11.56;
            location.LatitudeSpecified  = true;
            location.LocationUri        = "Location Uri";
            location.Longitude          = (double)1.9;
            location.LongitudeSpecified = true;
            location.PostalCode         = "Location sample postal code";
            location.State              = "Location sample state";
            location.Street             = "Location sample street";
            items.Add(location);
            itemsElementName.Add(Request.ItemsChoiceType8.Location);

            applicationData.Items            = items.ToArray();
            applicationData.ItemsElementName = itemsElementName.ToArray();
            SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncAddRequest(this.GetInitialSyncKey(this.User1Information.CalendarCollectionId), this.User1Information.CalendarCollectionId, applicationData);

            DataStructures.SyncStore syncAddResponse = this.ASAIRSAdapter.Sync(syncAddRequest);
            Site.Assert.IsTrue(syncAddResponse.AddResponses[0].Status.Equals("1"), "The sync add operation should be success; It is:{0} actually", syncAddResponse.AddResponses[0].Status);

            // Add the appointment to clean up list.
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject);
            #endregion

            #region Call Sync command to get the new added calendar item.
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion

            #region Call ItemOperations command to reterive the added calendar item.
            this.GetItemOperationsResult(this.User1Information.CalendarCollectionId, syncItem.ServerId, null, null, null, null);
            #endregion

            #region Call Sync command to remove the location of the added calender item.
            // Create empty change items list.
            List <object> changeItems = new List <object>();
            List <Request.ItemsChoiceType7> changeItemsElementName = new List <Request.ItemsChoiceType7>();

            // Create an empty location.
            location = new Request.Location();

            // Add the location field name into the change items element name list.
            changeItemsElementName.Add(Request.ItemsChoiceType7.Location);
            // Add the empty location value to the change items value list.
            changeItems.Add(location);

            // Create sync collection change.
            Request.SyncCollectionChange collectionChange = new Request.SyncCollectionChange
            {
                ServerId        = syncItem.ServerId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    ItemsElementName = changeItemsElementName.ToArray(),
                    Items            = changeItems.ToArray()
                }
            };

            // Create change sync collection
            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey      = this.SyncKey,
                CollectionId = this.User1Information.CalendarCollectionId,
                Commands     = new object[] { collectionChange }
            };

            // Create change sync request.
            SyncRequest syncChangeRequest = Common.CreateSyncRequest(new Request.SyncCollection[] { collection });

            // Change the location of the added calender by Sync request.
            DataStructures.SyncStore syncChangeResponse = this.ASAIRSAdapter.Sync(syncChangeRequest);
            Site.Assert.IsTrue(syncChangeResponse.CollectionStatus.Equals(1), "The sync change operation should be success; It is:{0} actually", syncChangeResponse.CollectionStatus);

            #region Call Sync command to get the new changed calendar item that removed the location.
            syncItem = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion

            #region Call ItemOperations command to reterive the changed calendar item that removed the location.
            DataStructures.ItemOperations itemOperations = this.GetItemOperationsResult(this.User1Information.CalendarCollectionId, syncItem.ServerId, null, null, null, null);
            #endregion
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R1001013");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R1001013
            Site.CaptureRequirementIfIsNull(
                itemOperations.Calendar.Location1.DisplayName,
                1001013,
                @"[In Location] The client's request can include an empty Location element to remove the location from an item.");
            #endregion

            if (Common.IsRequirementEnabled(53, this.Site))
            {
                #region Call Search command to search the added calendar item.
                this.GetSearchResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
                #endregion
            }
        }
Exemplo n.º 20
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
        }
Exemplo n.º 21
0
        public void MSASAIRS_S06_TC01_MeetingResponseWithPlainTextBody()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Body element under meetingresponse:SendResponse element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Body element under meetingresponse:SendResponse element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Body element under meetingresponse:SendResponse element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command with Add element to add a no recurrence meeting to the server.
            string subject       = Common.GenerateResourceName(Site, "Subject");
            string attendeeEmail = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);

            Dictionary <Request.ItemsChoiceType8, object> elementsToValueMap = TestSuiteHelper.SetMeetingProperties(subject, attendeeEmail, this.Site);
            DateTime startTime = DateTime.Now.AddMinutes(-5);
            DateTime endTime   = startTime.AddHours(1);
            elementsToValueMap.Add(Request.ItemsChoiceType8.StartTime, startTime.ToString("yyyyMMddTHHmmssZ"));
            elementsToValueMap.Add(Request.ItemsChoiceType8.EndTime, endTime.ToString("yyyyMMddTHHmmssZ"));

            this.SyncAddMeeting(this.User1Information.CalendarCollectionId, elementsToValueMap);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject);
            #endregion

            #region Call Sync command to get the added calendar item.
            SyncStore getChangeResult = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null);
            Microsoft.Protocols.TestSuites.Common.DataStructures.Sync resultItem = TestSuiteHelper.GetSyncAddItem(getChangeResult, subject);
            #endregion

            #region Call SendMail command to send the meeting request to attendee without setting BusyStatus.
            Calendar calendarItem = resultItem.Calendar;
            calendarItem.BusyStatus = null;
            this.SendMeetingRequest(subject, calendarItem);
            #endregion

            #region Call Sync command to get the meeting request and accept it.
            this.SwitchUser(this.User2Information, true);

            // Sync mailbox changes
            SyncStore syncChangeResult = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null);
            Microsoft.Protocols.TestSuites.Common.DataStructures.Sync meetingRequestEmail = TestSuiteHelper.GetSyncAddItem(syncChangeResult, subject);

            Request.MeetingResponseRequestSendResponse sendResoponse = new Request.MeetingResponseRequestSendResponse()
            {
                Body = new Request.Body()
                {
                    Type = 1,
                    Data = "Accept this meeting."
                }
            };

            // Accept the meeting request
            // Create a meeting response request item
            Request.MeetingResponseRequest meetingResponseRequestItem = new Request.MeetingResponseRequest
            {
                UserResponse = 1,
                CollectionId = this.User2Information.InboxCollectionId,
                RequestId    = meetingRequestEmail.ServerId,
                SendResponse = sendResoponse,
            };

            // Create a meeting response request
            MeetingResponseRequest  meetingRequest = Common.CreateMeetingResponseRequest(new Request.MeetingResponseRequest[] { meetingResponseRequestItem });
            MeetingResponseResponse response       = this.ASAIRSAdapter.MeetingResponse(meetingRequest);

            this.Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(response.ResponseData.Result[0].Status),
                1331,
                @"[In Body] When the Body element is a child of the meetingresponse:SendResponse element [or the composemail:SmartForward element], it has only the child elements Type and Data.");

            this.Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(response.ResponseData.Result[0].Status),
                1333,
                @"[In Body] The Body element is a child of the meetingresponse:SendResponse element and the composemail:SmartForward element only when protocol version 16.0 is used.");

            // Because the Type element is 1 and client call the MeetingResponse command successful.
            // So R1400 will be verified.
            this.Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(response.ResponseData.Result[0].Status),
                1400,
                @"[In Type (Body)] For calendar items in protocol version 16.0, the only valid values for this element [Type] is 1 (plain text).");
            #endregion

            #region Call Sync command to get the calendar item.
            SyncStore getCalendarItemsResult = this.GetSyncResult(subject, this.User2Information.CalendarCollectionId, null);
            Microsoft.Protocols.TestSuites.Common.DataStructures.Sync calendarResult = TestSuiteHelper.GetSyncAddItem(getCalendarItemsResult, subject);
            Site.Assert.IsNotNull(calendarResult.Calendar.BusyStatus, "Element BusyStatus should be present.");
            #endregion
        }
Exemplo n.º 22
0
        public void MSASAIRS_S04_TC05_IncorrectPlacement()
        {
            #region Send a plain text email
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body    = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.Plaintext, subject, body);
            #endregion

            #region Set BodyPreference element
            Request.BodyPreference[] bodyPreference = new Request.BodyPreference[]
            {
                new Request.BodyPreference()
                {
                    Type                    = 1,
                    TruncationSize          = 100,
                    TruncationSizeSpecified = true,
                    AllOrNone               = true,
                    AllOrNoneSpecified      = true
                }
            };
            #endregion

            #region Call ItemOperations command with incorrect placement of BodyPreference element.
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);

            if (Common.IsRequirementEnabled(10032, this.Site))
            {
                ItemOperationsRequest itemOperationRequest = TestSuiteHelper.CreateItemOperationsRequest(this.User2Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference, null);

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(itemOperationRequest.GetRequestDataSerializedXML());
                XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']");

                // Add another BodyPreference element in the BodyPreference element, the placement is invalid.
                XmlNode temp = bodyPreferenceNode.Clone();
                temp.SelectSingleNode("//*[name()='Type']").InnerText = "2";
                bodyPreferenceNode.AppendChild(temp);

                SendStringResponse itemOperationResponse = this.ASAIRSAdapter.ItemOperations(doc.OuterXml);

                string status = this.GetStatusCodeFromXPath(itemOperationResponse, "/i:ItemOperations/i:Status");

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

                // Verify MS-ASAIRS requirement: MS-ASAIRS_R10032
                Site.CaptureRequirementIfAreEqual(
                    "2",
                    status,
                    10032,
                    @"[In Appendix B: Product Behavior] Implementation does return protocol status error 2 for an ItemOperations command (as specified in [MS-ASCMD] section 2.2.2.8), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)");
            }
            #endregion

            #region Call Search command with incorrect placement of BodyPreference element.
            if (Common.IsRequirementEnabled(10036, this.Site))
            {
                SearchRequest searchRequest = TestSuiteHelper.CreateSearchRequest(subject, this.User2Information.InboxCollectionId, null, bodyPreference, null);
                XmlDocument   doc           = new XmlDocument();
                doc.LoadXml(searchRequest.GetRequestDataSerializedXML());
                XmlNode bodyPreferenceNode = doc.SelectSingleNode("//*[name()='BodyPreference']");

                // Add another BodyPreference element in the BodyPreference element, the placement is invalid.
                XmlNode temp = bodyPreferenceNode.Clone();
                temp.SelectSingleNode("//*[name()='Type']").InnerText = "2";
                bodyPreferenceNode.AppendChild(temp);

                SendStringResponse searchResponse = this.ASAIRSAdapter.Search(doc.OuterXml);
                string             searchStatus   = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Status");
                int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
                int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
                int counter    = 1;

                while (counter < retryCount && searchStatus.Equals("10"))
                {
                    Thread.Sleep(waitTime);
                    searchResponse = this.ASAIRSAdapter.Search(doc.OuterXml);
                    searchStatus   = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Status");
                    counter++;
                }

                string status = this.GetStatusCodeFromXPath(searchResponse, "/s:Search/s:Response/s:Store/s:Status");

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

                // Verify MS-ASAIRS requirement: MS-ASAIRS_R10036
                Site.CaptureRequirementIfAreEqual(
                    "2",
                    status,
                    10036,
                    @"[In Appendix B: Product Behavior] Implementation does return protocol status error 2 for a Search command (as specified in [MS-ASCMD] section 2.2.2.14), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)");
            }
            #endregion

            #region Call Sync add command with incorrect placement of Type element.
            if (Common.IsRequirementEnabled(10039, this.Site))
            {
                SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncRequest(this.GetInitialSyncKey(this.User2Information.InboxCollectionId), this.User2Information.InboxCollectionId, CreateSyncAddCommands(), null, null);
                XmlDocument doc            = new XmlDocument();
                doc.LoadXml(syncAddRequest.GetRequestDataSerializedXML());
                XmlNode bodyNode = doc.SelectSingleNode("//*[name()='Body']");

                // Add another body element in the body element, the placement is invalid.
                XmlNode temp = bodyNode.Clone();
                temp.SelectSingleNode("//*[name()='Type']").InnerText = "2";
                bodyNode.AppendChild(temp);

                SendStringResponse syncAddResponse = this.ASAIRSAdapter.Sync(doc.OuterXml);

                string status = this.GetStatusCodeFromXPath(syncAddResponse, "/a:Sync/a:Collections/a:Collection/a:Responses/a:Add/a:Status");

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

                // Verify MS-ASAIRS requirement: MS-ASAIRS_R10039
                Site.CaptureRequirementIfAreEqual(
                    "6",
                    status,
                    10039,
                    @"[In Appendix B: Product Behavior] Implementation does return protocol status error 6 for a Sync command (as specified in [MS-ASCMD] section 2.2.2.19), if an element does not meet the requirements[any of the XML elements specified in section 2.2.2 that are present in the command's XML body to ensure they comply with the requirements regarding placement] specified for that element, unless specified in the following table[section 3.2.5.1]. (Exchange Server 2007 SP1 and above follow this behavior.)");
            }
            #endregion
        }
Exemplo n.º 23
0
        public void MSASTASK_S02_TC01_RetrieveTaskItemWithItemOperations()
        {
            #region Call Sync command to create a task item

            Dictionary <Request.ItemsChoiceType8, object> taskItem = new Dictionary <Request.ItemsChoiceType8, object>();
            string subject = Common.GenerateResourceName(Site, "subject");
            taskItem.Add(Request.ItemsChoiceType8.Subject2, subject);

            #endregion

            #region Call Sync command to add the task to the server

            // add task
            SyncStore syncResponse = this.SyncAddTask(taskItem);
            Site.Assert.AreEqual <int>(1, int.Parse(syncResponse.AddResponses[0].Status), "Adding a task item to server should success.");
            SyncItem task = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);
            Site.Assert.IsNotNull(task.Task, "The task which subject is {0} should exist in server.", subject);
            ItemsNeedToDelete.Add(subject);

            #endregion

            #region Call ItemOperations command to fetch tasks

            syncResponse = this.SyncChanges(this.UserInformation.TasksCollectionId);

            List <string> serverIds = new List <string>();
            for (int i = 0; i < syncResponse.AddElements.Count; i++)
            {
                serverIds.Add(syncResponse.AddElements[i].ServerId);
            }

            Request.Schema schema = new Request.Schema
            {
                ItemsElementName = new Request.ItemsChoiceType4[1],
                Items            = new object[1]
            };
            schema.ItemsElementName[0] = Request.ItemsChoiceType4.Body;
            schema.Items[0]            = new Request.Body();

            Request.BodyPreference bodyReference = new Request.BodyPreference {
                Type = 1
            };

            ItemOperationsRequest itemOperationsRequest  = TestSuiteHelper.CreateItemOperationsFetchRequest(this.UserInformation.TasksCollectionId, serverIds, null, bodyReference, schema);
            ItemOperationsStore   itemOperationsResponse = this.TASKAdapter.ItemOperations(itemOperationsRequest);
            Site.Assert.AreEqual <string>("1", itemOperationsResponse.Status, "The ItemOperations response should be successful.");

            #endregion

            // Get task item that created in this case.
            ItemOperations taskReturnedInItemOperations = null;
            foreach (ItemOperations item in itemOperationsResponse.Items)
            {
                if (task.Task.Body.Data.ToString().Contains(item.Task.Body.Data))
                {
                    taskReturnedInItemOperations = item;
                }
            }

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R356
            // If the Task item in response is not null, this requirement will be captured.
            Site.CaptureRequirementIfIsNotNull(
                taskReturnedInItemOperations.Task,
                356,
                @"[In ItemOperations Command Response] When a client uses an ItemOperations command request ([MS-ASCMD] section 2.2.2.8) to retrieve data from the server for one or more specific Task items, as specified in section 3.1.5.1, the server responds with an ItemOperations command response ([MS-ASCMD] section 2.2.2.8).");

            bool otherPropertiesNull = true;

            // Loop to verify if other properties except "Body" are not returned.
            foreach (System.Reflection.PropertyInfo propertyInfo in typeof(Task).GetProperties())
            {
                if (propertyInfo.Name != "Body")
                {
                    object value = propertyInfo.GetValue(taskReturnedInItemOperations.Task, null);
                    if (value != null)
                    {
                        otherPropertiesNull = false;
                        break;
                    }
                }
            }

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R358
            // If the body of the Task item in response is not null, this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                otherPropertiesNull,
                358,
                @"[In ItemOperations Command Response] If an itemoperations:Schema element ([MS-ASCMD] section 2.2.3.135) is included in the ItemOperations command request, then the elements returned in the ItemOperations command response MUST be restricted to the elements that were included as child elements of the itemoperations:Schema element in the command request.");

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

            // Since MS-ASTASK_R358 is captured, this requirement can be captured.
            Site.CaptureRequirement(
                359,
                @"[In ItemOperations Command Response] Top-level Task class elements, as specified in section 2.2, MUST be returned as child elements of the itemoperations:Properties element ([MS-ASCMD] section 2.2.3.128) in the ItemOperations command response.");
        }
Exemplo n.º 24
0
        /// <summary>
        /// Load Change elements in Sync response
        /// </summary>
        /// <param name="collectionCommands">The change operation response</param>
        /// <param name="changeElements">The collection to be loaded in</param>
        public static void LoadChangeElements(Response.SyncCollectionsCollectionCommands collectionCommands, Collection<DataStructures.Sync> changeElements)
        {
            if (collectionCommands.Change == null)
            {
                return;
            }

            foreach (Response.SyncCollectionsCollectionCommandsChange changeCommand in collectionCommands.Change)
            {
                DataStructures.Sync syncItem = new DataStructures.Sync { ServerId = changeCommand.ServerId };
                if (changeCommand.ApplicationData != null && changeCommand.ApplicationData.ItemsElementName.Length > 0)
                {
                    syncItem.Email = DataStructures.Email.DeserializeFromChangeApplicationData<DataStructures.Email>(changeCommand.ApplicationData);
                    syncItem.Calendar = DataStructures.Calendar.DeserializeFromChangeApplicationData<DataStructures.Calendar>(changeCommand.ApplicationData);
                    syncItem.Note = DataStructures.Note.DeserializeFromChangeApplicationData<DataStructures.Note>(changeCommand.ApplicationData);
                    syncItem.Contact = DataStructures.Contact.DeserializeFromChangeApplicationData<DataStructures.Contact>(changeCommand.ApplicationData);
                    syncItem.Task = DataStructures.Task.DeserializeFromChangeApplicationData<DataStructures.Task>(changeCommand.ApplicationData);
                }

                changeElements.Add(syncItem);
            }
        }
        public void MSASTASK_S03_TC01_RetrieveTaskItemWithSearch()
        {
            #region Call Sync command to create a task item

            Dictionary <Request.ItemsChoiceType8, object> taskItem = new Dictionary <Request.ItemsChoiceType8, object>();
            string subject = Common.GenerateResourceName(Site, "subject");
            taskItem.Add(Request.ItemsChoiceType8.Subject2, subject);

            #endregion

            #region Call Sync command to add the task to the server

            // add task
            SyncStore syncResponse = this.SyncAddTask(taskItem);
            Site.Assert.AreEqual <int>(1, int.Parse(syncResponse.AddResponses[0].Status), "Adding a task item to server should success.");
            SyncItem task = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);
            Site.Assert.IsNotNull(task.Task, "The task which subject is {0} should exist in server.", subject);
            ItemsNeedToDelete.Add(subject);

            #endregion

            #region Call Search command to search task on the server

            Request.Options1 option = new Request.Options1();
            Dictionary <Request.ItemsChoiceType6, object> items = new Dictionary <Request.ItemsChoiceType6, object>
            {
                {
                    Request.ItemsChoiceType6.DeepTraversal, string.Empty
                },
                {
                    Request.ItemsChoiceType6.RebuildResults, string.Empty
                },
                {
                    Request.ItemsChoiceType6.Range, "0-9"
                }
            };
            option.Items            = items.Values.ToArray <object>();
            option.ItemsElementName = items.Keys.ToArray <Request.ItemsChoiceType6>();

            Request.queryType queryItem = new Request.queryType
            {
                Items = new object[] { "Tasks", this.UserInformation.TasksCollectionId, subject },

                ItemsElementName = new Request.ItemsChoiceType2[]
                {
                    Request.ItemsChoiceType2.Class,
                    Request.ItemsChoiceType2.CollectionId,
                    Request.ItemsChoiceType2.FreeText
                }
            };

            Request.queryType queryType = new Request.queryType
            {
                Items            = new object[] { queryItem },
                ItemsElementName = new Request.ItemsChoiceType2[] { Request.ItemsChoiceType2.And }
            };

            SearchRequest searchRequest = TestSuiteHelper.CreateSearchRequest(SearchName.Mailbox.ToString(), option, queryType);

            // Search the task
            SearchStore searchResponse = this.TASKAdapter.Search(searchRequest);

            // Verify search response
            Site.Assert.AreNotEqual <int>(0, searchResponse.Range.Length, "The search response should be successful");

            #endregion

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R361
            // If the Task item in response is not null, this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                searchResponse.Results[0].Task,
                361,
                @"[In Search Command Response] When a client uses the Search command request ([MS-ASCMD] section 2.2.2.14) to retrieve Task class items from the server that match the criteria specified by the client, as specified in section 3.1.5.2, the server responds with a Search command response ([MS-ASCMD] section 2.2.2.14).");

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

            // Since MS-ASTASK_R361 is captured, this requirement can be captured too.
            Site.CaptureRequirement(
                363,
                @"[In Search Command Response] Top-level Task class elements, as specified in section 2.2, are returned as child elements of the search:Properties element ([MS-ASCMD] section 2.2.3.128) in the Search command response.");
        }