示例#1
0
        public void MSASRM_S03_TC01_Search_RightsManagedEmailMessages()
        {
            this.CheckPreconditions();

            #region The client logs on User1's account, calls Settings command to get a templateID with all rights allowed.
            string templateID = this.GetTemplateID("MSASRM_AllRights_AllowedTemplate");
            #endregion

            #region The client logs on User1's account, calls SendMail command with the templateID to send a rights-managed e-mail message to User2, switches to User2, and calls FolderSync command.
            string subject = this.SendMailAndFolderSync(templateID, false, null);
            #endregion

            #region The client logs on User2's account, calls Search command to search the rights-managed e-mail message from server.
            SearchRequest searchRequest = Common.CreateSearchRequest(subject, this.UserTwoInformation.InboxCollectionId);
            searchRequest.RequestData.Items[0].Options.Items            = new object[] { string.Empty, string.Empty, true };
            searchRequest.RequestData.Items[0].Options.ItemsElementName = new Request.ItemsChoiceType6[]
            {
                Request.ItemsChoiceType6.RebuildResults,
                Request.ItemsChoiceType6.DeepTraversal,
                Request.ItemsChoiceType6.RightsManagementSupport
            };

            SearchStore result = this.ASRMAdapter.Search(searchRequest);

            Site.Assert.AreEqual <int>(1, result.Results.Count, "There should be only 1 item fetched in ItemOperations command response.");
            Search search = result.Results[0];
            Site.Assert.IsNotNull(search, "The returned item should not be null.");
            Site.Assert.IsNotNull(search.Email, "The expected rights-managed e-mail message should not be null.");
            Site.Assert.IsNull(search.Email.Attachments, "The Attachments element in expected rights-managed e-mail message should be null.");
            Site.Assert.IsNotNull(search.Email.RightsManagementLicense, "The RightsManagementLicense element in expected rights-managed e-mail message should not be null.");
            #endregion
        }
        public void MSASNOTE_S03_TC02_ItemOperations_SchemaViewFetch()
        {
            #region Call method Sync to add a note to the server
            Dictionary <Request.ItemsChoiceType8, object> addElements = this.CreateNoteElements();
            this.SyncAdd(addElements, 1);
            #endregion

            #region Call method Search to search notes using the given keyword text

            // Search note from server
            SearchStore result = this.NOTEAdapter.Search(this.UserInformation.NotesCollectionId, addElements[Request.ItemsChoiceType8.Subject1].ToString(), true, 1);

            Site.Assert.AreEqual <int>(
                1,
                result.Results.Count,
                @"There should be only one note item returned in sync response.");

            #endregion

            #region Call method ItemOperations to fetch all the information about notes using longIds.
            // longIds:Long id of the created note item.
            List <string> longIds = new List <string> {
                result.Results[0].LongId
            };

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

            // serverIds:null
            ItemOperationsRequest itemOperationRequest = TestSuiteHelper.CreateItemOperationsFetchRequest(null, null, longIds, bodyReference, schema);
            ItemOperationsStore   itemOperationsResult = this.NOTEAdapter.ItemOperations(itemOperationRequest);
            Site.Assert.IsNotNull(itemOperationsResult, "The ItemOperations result must not be null!");

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

            Site.Assert.IsNull(itemOperationsResult.Items[0].Note.Subject, "Subject should be null.");
            Site.Assert.IsNull(itemOperationsResult.Items[0].Note.MessageClass, "MessageClass should be null.");
            Site.Assert.IsNull(itemOperationsResult.Items[0].Note.Categories, "Categories should be null.");
            Site.Assert.IsFalse(itemOperationsResult.Items[0].Note.IsLastModifiedDateSpecified, "LastModifiedSpecified should not be present.");

            // Verify MS-ASNOTE requirement: MS-ASNOTE_R103
            Site.CaptureRequirementIfIsNotNull(
                itemOperationsResult.Items[0].Note.Body,
                103,
                @"[In ItemOperations Command Response] If an itemoperations:Schema element ([MS-ASCMD] section 2.2.3.145) 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.");

            #endregion
        }
        /// <summary>
        /// Call Search command to find a specified conversation.
        /// </summary>
        /// <param name="conversationId">The ConversationId of the items to search.</param>
        /// <param name="itemsCount">The count of the items expected to be found.</param>
        /// <param name="bodyPartPreference">The BodyPartPreference element.</param>
        /// <param name="bodyPreference">The BodyPreference element.</param>
        /// <returns>The SearchStore instance that contains the search result.</returns>
        protected SearchStore CallSearchCommand(string conversationId, int itemsCount, Request.BodyPartPreference bodyPartPreference, Request.BodyPreference bodyPreference)
        {
            // Create Search command request.
            SearchRequest searchRequest = TestSuiteHelper.GetSearchRequest(conversationId, bodyPartPreference, bodyPreference);
            SearchStore   searchStore   = this.CONAdapter.Search(searchRequest, true, itemsCount);

            Site.Assert.AreEqual("1", searchStore.Status, "The Search operation should be success.");

            return(searchStore);
        }
示例#4
0
        public void MSASNOTE_S02_TC01_Search_GetZeroOrMoreNotes()
        {
            #region Call method Sync to add two notes to the server
            Dictionary <Request.ItemsChoiceType8, object> addElements = this.CreateNoteElements();
            this.SyncAdd(addElements, 2);
            #endregion

            #region Call method Search to search notes using the given keyword text
            // Search note from server
            SearchStore result = this.NOTEAdapter.Search(this.UserInformation.NotesCollectionId, Common.GeneratePrefixOfResourceName(this.Site) + "_subject", true, 2);

            this.Site.Assert.AreEqual <int>(
                2,
                result.Results.Count,
                @"Two results should be returned in Search response.");

            this.Site.Assert.IsNotNull(
                result.Results[0].Note,
                @"The first note class in Search response should not be null.");

            this.Site.Assert.IsNotNull(
                result.Results[1].Note,
                @"The second note class in Search response should not be null.");

            #endregion

            #region Call method Search to search notes using an invalid keyword text

            result = this.NOTEAdapter.Search(this.UserInformation.NotesCollectionId, Common.GenerateResourceName(this.Site, "notExisting_subject"), false, 0);

            this.Site.Assert.AreEqual <int>(
                0,
                result.Results.Count,
                @"No results should be returned in Search response.");

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

            // Verify MS-ASNOTE requirement: MS-ASNOTE_R208
            // Server can return zero or more Notes class blocks which can be seen from two steps above.
            this.Site.CaptureRequirement(
                208,
                @"[In Abstract Data Model] The server returns a Notes class XML block for every note that matches the criteria specified by the client command request.");

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

            // Verify MS-ASNOTE requirement: MS-ASNOTE_R128
            // Server can return zero or more Notes class blocks which can be seen from two steps above.
            this.Site.CaptureRequirement(
                128,
                @"[In Abstract Data Model] The server can return zero or more Notes class XML blocks in its response, depending on how many notes match the criteria specified by the client command request.");

            #endregion
        }
        /// <summary>
        /// Search data using the given keyword text.
        /// </summary>
        /// <param name="searchRequest">A Search command request.</param>
        /// <returns>A Search command response returned from the server.</returns>
        public SearchStore Search(SearchRequest searchRequest)
        {
            SearchResponse response = this.activeSyncClient.Search(searchRequest, true);

            Site.Assert.IsNotNull(response, "The Search response should be returned.");
            SearchStore searchResponse = Common.LoadSearchResponse(response, Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site));

            this.VerifySearchCommandResponse(searchResponse);

            return(searchResponse);
        }
示例#6
0
        /// <summary>
        /// Search data using the given keyword text.
        /// </summary>
        /// <param name="searchRequest">A Search command request.</param>
        /// <returns>A Search command response returned from the server.</returns>
        public SearchStore Search(SearchRequest searchRequest)
        {
            SearchResponse response = this.activeSyncClient.Search(searchRequest, true);

            Site.Assert.IsNotNull(response, "The Search response should be returned.");
            SearchStore searchResponse = Common.LoadSearchResponse(response);

            this.VerifySearchCommandResponse(searchResponse);

            return(searchResponse);
        }
        /// <summary>
        /// Finds entries in an address book, mailbox or document library by sending SearchRequest object.
        /// </summary>
        /// <param name="request">A SearchRequest object that contains the request information.</param>
        /// <returns>A SearchStore object.</returns>
        public SearchStore Search(SearchRequest request)
        {
            SearchResponse response = this.activeSyncClient.Search(request, true);

            Site.Assert.IsNotNull(response, "If the Search command executes successfully, the response from server should not be null.");
            SearchStore searchStore = Common.LoadSearchResponse(response, Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site));

            this.VerifySearchResponse(response, searchStore);
            this.VerifyWBXMLCapture();

            return(searchStore);
        }
示例#8
0
        /// <summary>
        /// Search items on server.
        /// </summary>
        /// <param name="searchRequest">The request for Search command.</param>
        /// <returns>The Search result which is returned from server.</returns>
        public SearchStore Search(SearchRequest searchRequest)
        {
            SearchResponse response = this.activeSyncClient.Search(searchRequest, true);

            Site.Assert.IsNotNull(response, "If the command is successful, the response should not be null.");
            SearchStore result = Common.LoadSearchResponse(response);

            this.VerifyTransport();
            this.VerifyWBXMLCapture();
            this.VerifySearchResponse(result);
            return(result);
        }
        /// <summary>
        /// Search items on server.
        /// </summary>
        /// <param name="searchRequest">The request for Search command.</param>
        /// <returns>The Search result which is returned from server.</returns>
        public SearchStore Search(SearchRequest searchRequest)
        {
            SearchResponse response = this.activeSyncClient.Search(searchRequest, true);

            Site.Assert.IsNotNull(response, "If the command is successful, the response should not be null.");
            SearchStore result = Common.LoadSearchResponse(response, Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site));

            this.VerifyTransport();
            this.VerifyWBXMLCapture();
            this.VerifySearchResponse(result);
            return(result);
        }
示例#10
0
        /// <summary>
        /// Finds entries in an address book, mailbox or document library by sending SearchRequest object.
        /// </summary>
        /// <param name="request">A SearchRequest object that contains the request information.</param>
        /// <returns>A SearchStore object.</returns>
        public SearchStore Search(SearchRequest request)
        {
            SearchResponse response = this.activeSyncClient.Search(request, true);

            Site.Assert.IsNotNull(response, "If the Search command executes successfully, the response from server should not be null.");
            SearchStore searchStore = Common.LoadSearchResponse(response);

            this.VerifySearchResponse(response, searchStore);
            this.VerifyWBXMLCapture();

            return(searchStore);
        }
示例#11
0
        /// <summary>
        /// Loop to get the results of the specific query request by Search command.
        /// </summary>
        /// <param name="collectionId">The CollectionId of the folder to search.</param>
        /// <param name="subject">The subject of the note to get.</param>
        /// <param name="isLoopNeeded">A boolean value specify whether need the loop</param>
        /// <param name="expectedCount">The expected number of the note to be found.</param>
        /// <returns>The results in response of Search command</returns>
        public SearchStore Search(string collectionId, string subject, bool isLoopNeeded, int expectedCount)
        {
            SearchRequest  searchRequest = Common.CreateSearchRequest(subject, collectionId);
            SearchResponse response      = this.activeSyncClient.Search(searchRequest, isLoopNeeded, expectedCount);

            this.VerifySearchResponse(response);
            SearchStore result = Common.LoadSearchResponse(response, Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site));

            this.VerifyTransport();
            this.VerifySearchResult(result);
            this.VerifyWBXMLCapture();
            return(result);
        }
        /// <summary>
        /// Loop to get the results of the specific query request by Search command.
        /// </summary>
        /// <param name="collectionId">The CollectionId of the folder to search.</param>
        /// <param name="subject">The subject of the note to get.</param>
        /// <param name="isLoopNeeded">A boolean value specify whether need the loop</param>
        /// <param name="expectedCount">The expected number of the note to be found.</param>
        /// <returns>The results in response of Search command</returns>
        public SearchStore Search(string collectionId, string subject, bool isLoopNeeded, int expectedCount)
        {
            SearchRequest  searchRequest = Common.CreateSearchRequest(subject, collectionId);
            SearchResponse response      = this.activeSyncClient.Search(searchRequest, isLoopNeeded, expectedCount);

            this.VerifySearchResponse(response);
            SearchStore result = Common.LoadSearchResponse(response);

            this.VerifyTransport();
            this.VerifySearchResult(result);
            this.VerifyWBXMLCapture();
            return(result);
        }
示例#13
0
        /// <summary>
        /// This method is used to verify the Search Command response related requirements.
        /// </summary>
        /// <param name="searchResponse">Specified the SearchStore result from the server</param>
        private void VerifySearchResult(SearchStore searchResponse)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R108");

            // Verify MS-ASNOTE requirement: MS-ASNOTE_R108
            Site.CaptureRequirementIfIsTrue(
                this.activeSyncClient.ValidationResult,
                108,
                @"[In Search Command Response] Notes class elements[airsyncbase:Body, Subject, MessageClass, LastModifiedDate, Categories or Category] are returned as child elements of the search:Properties element ([MS-ASCMD] section 2.2.3.128) in the Search command response.");

            foreach (Search search in searchResponse.Results)
            {
                this.VerifyNote(search.Note, false);
            }

            this.VerifyMessageSyntax();
        }
示例#14
0
        /// <summary>
        /// Find entries address book, mailbox, or document library.
        /// </summary>
        /// <param name="searchRequest">A SearchRequest object that contains the request information.</param>
        /// <param name="expectSuccess">Whether the Search command is expected to be successful.</param>
        /// <param name="itemsCount">The count of the items expected to be found.</param>
        /// <returns>The SearchStore result which is returned from server.</returns>
        public SearchStore Search(SearchRequest searchRequest, bool expectSuccess, int itemsCount)
        {
            SearchResponse searchResponse;

            if (expectSuccess)
            {
                searchResponse = this.activeSyncClient.Search(searchRequest, true, itemsCount);
            }
            else
            {
                searchResponse = this.activeSyncClient.Search(searchRequest);
            }

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

            while (counter < retryCount && searchResponse.ResponseData.Status.Equals("10"))
            {
                Thread.Sleep(waitTime);

                if (expectSuccess)
                {
                    searchResponse = this.activeSyncClient.Search(searchRequest, true, itemsCount);
                }
                else
                {
                    searchResponse = this.activeSyncClient.Search(searchRequest);
                }

                counter++;
            }

            Site.Assert.IsNotNull(searchResponse, "The Search response returned from server should not be null.");

            // Verify related requirements.
            this.VerifyCommonRequirements();
            this.VerifyWBXMLCapture();

            SearchStore searchStore = Common.LoadSearchResponse(searchResponse);

            return(searchStore);
        }
示例#15
0
        /// <summary>
        /// Get document class value of a specific folder or document.
        /// </summary>
        /// <param name="linkId">UNC path of shared folder or document in server.</param>
        /// <returns>Search command response.</returns>
        protected SearchResponse SearchCommand(string linkId)
        {
            // Initialize a store object
            SearchStore store = new SearchStore {
                Name = SearchName.DocumentLibrary.ToString(), Query = new queryType()
            };

            if (linkId != null)
            {
                // Give the query values
                queryTypeEqualTo subQuery = new queryTypeEqualTo {
                    LinkId = string.Empty, Value = linkId
                };
                store.Query.ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.EqualTo };
                store.Query.Items            = new object[] { subQuery };
            }

            store.Options = new Options1 {
                ItemsElementName = new ItemsChoiceType6[2]
            };
            store.Options.ItemsElementName[0] = ItemsChoiceType6.UserName;
            store.Options.ItemsElementName[1] = ItemsChoiceType6.Password;
            store.Options.Items    = new string[2];
            store.Options.Items[0] = Common.GetConfigurationPropertyValue("UserName", this.Site);
            store.Options.Items[1] = Common.GetConfigurationPropertyValue("UserPassword", this.Site);

            // Create a search command request.
            SearchRequest searchRequest = Common.CreateSearchRequest(new SearchStore[] { store });

            // Get search command response.
            SearchResponse searchResponse = this.ASDOCAdapter.Search(searchRequest);

            Site.Assert.AreEqual <HttpStatusCode>(HttpStatusCode.OK, searchResponse.StatusCode, "The call should be successful.");

            return(searchResponse);
        }
示例#16
0
 public void searchStoreOrder(int id) => SearchStore.ReturnStoreOrderHistory(Stores, id);
示例#17
0
 public void searchStoreInventory(int id) => SearchStore.ReturnStoreInventory(Stores, id);
        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.");
        }
 private void SearchStoreMethod()
 {
     if (!string.IsNullOrWhiteSpace(SearchStore))
     {
         SearchStoreResultList = new ObservableCollection <StoresSet>(StoreList.Where(s => s.StoreName.ToLower().Contains(SearchStore.ToLower()) || s.StoreNumber.ToString().Contains(SearchStore)));
     }
     else
     {
         SearchStoreResultList.Clear();
     }
 }