Microsoft.Protocols.TestSuites.MS_ASCON.TestSuiteHelper.GetSearchRequest C# (CSharp) Method

GetSearchRequest() static private method

Get the request of Search command.
static private GetSearchRequest ( string conversationId, Request bodyPartPreference, Request bodyPreference ) : SearchRequest
conversationId string The conversation for which to search.
bodyPartPreference Microsoft.Protocols.TestSuites.Common.Request The BodyPartPreference in the Options element.
bodyPreference Microsoft.Protocols.TestSuites.Common.Request The BodyPreference in the Options element.
return SearchRequest
        internal static SearchRequest GetSearchRequest(string conversationId, Request.BodyPartPreference bodyPartPreference, Request.BodyPreference bodyPreference)
        {
            SearchRequest request = new SearchRequest
            {
                RequestData =
                {
                    Items = new Request.SearchStore[]
                    {
                        new Request.SearchStore()
                        {
                            Name = SearchName.Mailbox.ToString(),
                            Query = new Request.queryType()
                            {
                                Items = new object[]
                                {
                                    new Request.queryType()
                                    {
                                        Items = new object[]
                                        {
                                            "Email",
                                            conversationId
                                        },
                                        ItemsElementName = new Request.ItemsChoiceType2[]
                                        {
                                            Request.ItemsChoiceType2.Class,
                                            Request.ItemsChoiceType2.ConversationId
                                        }
                                    }
                                },
                                ItemsElementName = new Request.ItemsChoiceType2[]
                                {
                                    Request.ItemsChoiceType2.And
                                }
                            }
                        }
                    }
                }
            };

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

            if (bodyPreference != null)
            {
                items.Add(bodyPreference);
                itemsElementName.Add(Request.ItemsChoiceType6.BodyPreference);
            }

            if (bodyPartPreference != null)
            {
                items.Add(bodyPartPreference);
                itemsElementName.Add(Request.ItemsChoiceType6.BodyPartPreference);
            }

            items.Add(string.Empty);
            itemsElementName.Add(Request.ItemsChoiceType6.RebuildResults);
            items.Add("0-9");
            itemsElementName.Add(Request.ItemsChoiceType6.Range);
            items.Add(string.Empty);
            itemsElementName.Add(Request.ItemsChoiceType6.DeepTraversal);

            request.RequestData.Items[0].Options = new Request.Options1()
            {
                ItemsElementName = itemsElementName.ToArray(),
                Items = items.ToArray()
            };

            return request;
        }

Usage Example

        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
            }
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.MS_ASCON.TestSuiteHelper::GetSearchRequest