public void ReplacingOneSearchPropertyWithAnotherActuallyReplacesAllProperties() { var fakePlatform = A.Fake <IPlatformSpecific>(); var firstProperty = new SearchProperties() { Query = "My first query", ItemTypeIndex = 0, Language = Language.GetUnknown(fakePlatform), OrderAscending = true, SortType = SearchProperties.SearchPropertiesSortType.ByCreationDate, Tag = default(Tag) }; var secondProperty = new SearchProperties() { Query = "My second query", ItemTypeIndex = 1, Language = new Language("de"), OrderAscending = false, SortType = SearchProperties.SearchPropertiesSortType.ByReadingTime, Tag = new Tag() { Label = "test" } }; firstProperty.Replace(secondProperty); Assert.Equal("My second query", firstProperty.Query); Assert.Equal(1, firstProperty.ItemTypeIndex); Assert.Equal(new Language("de"), firstProperty.Language); Assert.Equal(false, firstProperty.OrderAscending); Assert.Equal(SearchProperties.SearchPropertiesSortType.ByReadingTime, firstProperty.SortType); Assert.Equal("test", firstProperty.Tag.Label); }
public WndImageProOnlineHelp() { #region Search Criteria AutomationElement rootElement = AutomationElement.RootElement; SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Image-Pro Online Help", PropertyExpressionOperator.Contains)); #endregion }
private static async void ExecuteSearch(SearchProperties searchProperties) { IDatabaseSearchExecutor databaseSearchExecutor = new DatabaseSearchExecutor(); var searchResults = await databaseSearchExecutor.ExecuteSearchAsync(searchProperties); var count = searchResults.Count; Console.WriteLine(count); foreach (var result in searchResults) { IPaperSummaryRetriever paperSummaryRetriever = new PaperSummaryRetriever(); var summary = await paperSummaryRetriever.RetrievePaperSummaryAsync(new SummaryRetrievalProperties(_entrezDatabase, result.PubMedID)); if (summary.AuthorList != null) { if (summary.AuthorList.Count > 0) { Console.WriteLine(summary.Title); IFullTextLinkRetriever fullTextLinkRetriever = new FullTextLinkRetriever(); var fullTextLinkOptions = await fullTextLinkRetriever.RetrieveFullTextLinkOptionsAsync(_entrezDatabase, summary.ID); if (fullTextLinkOptions.Count > 0) { Process.Start("explorer.exe", fullTextLinkOptions[0].UrlToFullText); } } } } Console.ReadLine(); }
public void TestFindTwoCars() { string expected = "Фамилия: Тупин" + Environment.NewLine + "Код марки: 3" + Environment.NewLine + "Марка автомобиля: Волга" + Environment.NewLine + "Требуемая марка бензина: gas3" + Environment.NewLine + "Мощность двигателя: 100" + Environment.NewLine + "Объём бака: 60" + Environment.NewLine + "Остаток бензина: 10" + Environment.NewLine + "Объём масла: 4" + Environment.NewLine + "Цена литра бензина: 0" + Environment.NewLine + "Цена заливки масла: 0" + Environment.NewLine + Environment.NewLine + "Фамилия: Тупин" + Environment.NewLine + "Код марки: 3" + Environment.NewLine + "Марка автомобиля: Волга" + Environment.NewLine + "Требуемая марка бензина: gas4" + Environment.NewLine + "Мощность двигателя: 100" + Environment.NewLine + "Объём бака: 60" + Environment.NewLine + "Остаток бензина: 10" + Environment.NewLine + "Объём масла: 4" + Environment.NewLine + "Цена литра бензина: 0" + Environment.NewLine + "Цена заливки масла: 0" + Environment.NewLine + Environment.NewLine; MainForm.source = sourcesPath + "f12.xml"; TextBox textBox = new TextBox(); SearchProperties searchProperties = new SearchProperties(null); var searchResult = searchProperties.Search(0, "Тупин"); MainForm.PrintElements(textBox, searchResult); Assert.AreEqual(textBox.Text, expected); }
public UIStudioWindow() { SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Warewolf", PropertyExpressionOperator.Contains)); }
public ActionResult AjaxIndex(SearchProperties model) { ViewBag.Source = model.Source; ViewBag.SortOrder = model.SortOrder; var news = RssRepository.News; if (model.Source != "All") { news = news.Where(n => n.Source.Name == model.Source); } switch (model.SortOrder) { case "source": news = news.OrderBy(n => n.Source.Name); break; case "date": news = news.OrderBy(n => n.Date); break; } int pageSize = 10; int pageNumber = 1; return(View("AjaxPost", news.ToPagedList(pageNumber, pageSize))); }
/// <summary> /// 得到属性 /// </summary> /// <returns></returns> public virtual string GetPropertyUrl(long id, string name, string value) { if (string.IsNullOrEmpty(value)) { return(null); } var infos = new List <PropertyEntity>(); if (ExistSearchProperties != null && ExistSearchProperties.Count > 0) { if (ExistSearchProperties.FirstOrDefault(it => it.Id == id && it.Value == value) != null) { return(null); } var p = SearchProperties.FirstOrDefault(it => it.Id == id); if (p != null && (p.SearchType == PropertySearchType.None || p.SearchType == PropertySearchType.Select)) { infos.AddRange(ExistSearchProperties.Where(it => it.Id != id)); } else { infos.AddRange(ExistSearchProperties); } infos.Add(new PropertyEntity { Id = id, Name = name, Value = value }); } else { infos.Add(new PropertyEntity { Id = id, Name = name, Value = value }); } return(SerializeProperty(infos)); }
public IActionResult Search(SearchProperties searchProperties) { var dBOperations = new DBOperations(); var searchResult = dBOperations.Search(searchProperties); return(View(searchResult)); }
public WndProjectWorkbench() { #region Search Criteria AutomationElement rootElement = AutomationElement.RootElement; SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Project Workbench", PropertyExpressionOperator.Contains)); #endregion }
public HtmlRow(UITestControl parent) : base(parent) { SearchProperties.Add(HtmlRow.PropertyNames.TagName, "tr"); RulesDictionary.Add(HtmlRow.PropertyNames.RowIndex, ByRowIndex); }
private void mnuAndOrSearch(object sender, EventArgs e) { try { TreeNode tn = tvSearchs.SelectedNode; SearchProperties searchProperties = (SearchProperties)(tn.Tag); if (tn != null) { if (searchProperties.Criteria == MatchCriteria.And) { searchProperties.Criteria = MatchCriteria.Or; } else { searchProperties.Criteria = MatchCriteria.And; } tn.Text = searchProperties.Name + " {" + searchProperties.Criteria + "}"; } } catch (Exception ex) { MessageBox.Show(ex.Message, "AND/OR Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void mnuRemoveSearch(object sender, EventArgs e) { try { TreeNode tn = tvSearchs.SelectedNode; if (tn == null) { return; } string sText = tn.Text; for (int i = 0; i < tvSearchs.Nodes[0].Nodes.Count; i++) { SearchProperties currentSearchProperties = (SearchProperties)(tvSearchs.Nodes[0].Nodes[i].Tag); if (currentSearchProperties.Name == sText) { tvSearchs.Nodes[0].Nodes.RemoveAt(i); return; } } tvSearchs.ExpandAll(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Remove Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async Task <ActionResult> DisplaySearchResultsAsync(PsfModel model, int page, bool notPaging = true) { var resultModel = GetPsfSearchResultsViewModel(model, notPaging); var pageNumber = page > 0 ? page : 1; var fieldDefinitions = GetIndexFieldDefinitions(); var resultsModel = mapper.Map <PreSearchFiltersResultsModel>(model); var properties = new SearchProperties { Page = pageNumber, Count = this.PageSize, FilterBy = buildSearchFilterService.BuildPreSearchFilters(resultsModel, fieldDefinitions.ToDictionary(k => k.Key, v => v.Value)) }; var results = await searchQueryService.SearchAsync("*", properties); resultModel.Count = results.Count; resultModel.PageNumber = pageNumber; resultModel.SearchResults = mapper.Map <IEnumerable <JobProfileSearchResultItemViewModel> >(results.Results); foreach (var resultItem in resultModel.SearchResults) { resultItem.ResultItemUrlName = $"{JobProfileDetailsPage}{resultItem.ResultItemUrlName}"; } SetTotalResultsMessage(resultModel); SetupPagination(resultModel); return(View("SearchResult", resultModel)); }
public string TrimCommonWordsAndSuffixes(string searchTerm, SearchProperties properties) { if (properties?.UseRawSearchTerm == true) { return searchTerm; } var result = searchTerm?.Any(char.IsWhiteSpace) == true ? searchTerm .Split(' ') .Aggregate(string.Empty, (current, term) => { if (IsCommonCojoinginWord(term)) { return $"{current}"; } else { return $"{current} {TrimAndReplaceSuffixOnCurrentTerm(term)}"; } }) : TrimAndReplaceSuffixOnCurrentTerm(searchTerm); return result.Trim(); }
public HtmlCellBase(UITestControl parent) : base(parent) { SearchProperties.Add(HtmlControl.PropertyNames.TagName, "td"); RulesDictionary.Add(HtmlCell.PropertyNames.ColumnIndex, ByColumnIndex); RulesDictionary.Add(HtmlCell.PropertyNames.RowIndex, ByRowIndex); }
public UIErrorWindow() { #region Search Criteria SearchProperties[UITestControl.PropertyNames.Name] = "Error"; SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); WindowTitles.Add("Error"); #endregion }
public WndMacrosVb() { #region Search Criteria AutomationElement rootElement = AutomationElement.RootElement; SearchProperties[UITestControl.PropertyNames.Name] = "Macros.vb - Project Workbench"; SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); WindowTitles.Add("Macros.vb - Project Workbench"); #endregion }
private static SearchProperties BuildSearchProperties() { var searchProperties = new SearchProperties(); searchProperties.Database = _entrezDatabase; searchProperties.MaximumResults = 5; searchProperties.BaseSearchTermGroup = BuildSearch(); return(searchProperties); }
private static IQueryable <QueueMessage> AddSortingToQueryDefinition(SearchProperties searchProperties, IQueryable <QueueMessage> queryDefinition) { if (!string.IsNullOrEmpty(searchProperties.Order)) { queryDefinition = queryDefinition.OrderBy($"{searchProperties.Sort} {searchProperties.Order}"); } return(queryDefinition); }
public UIDemandsNeedsMotorComWindow() { #region Search Criteria SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Demands&Needs(", PropertyExpressionOperator.Contains)); SearchProperties[UITestControl.PropertyNames.ClassName] = "OpusApp"; #endregion }
private static IQueryable <QueueMessage> AddPagingToQueryDefinition(SearchProperties searchProperties, IQueryable <QueueMessage> queryDefinition) { if (searchProperties.Offset.HasValue && searchProperties.Limit.HasValue) { queryDefinition = queryDefinition.Skip(searchProperties.Offset.Value).Take(searchProperties.Limit.Value); } return(queryDefinition); }
public IEnumerable <Product> Search(SearchProperties searchProperties) { var products = GetProducts(); IEnumerable <Product> searchResult = (from product in products where (product.ProductName.ToLower().Contains(searchProperties.SearchValue.ToLower()) || searchProperties.SearchValue == null) && product.ProductPrice >= searchProperties.Min && product.ProductPrice <= searchProperties.Max && product.ProductCategoryID == searchProperties.CategoryID select product).ToList(); return(searchResult); }
public UISearchResultForB338TWindow() { #region Search Criteria SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Search Result For", PropertyExpressionOperator.Contains)); SearchProperties[UITestControl.PropertyNames.ClassName] = "ThunderRT6FormDC"; #endregion }
public SearchViewModel() { foreach (var p in PropertySearcher.GetSearchProperties(typeof(TEntity))) { SingleProperty property = ContainerManager.RegisterProperty(p); SearchProperties.Add(property); } }
private bool CustomerFilter(object item) { //IGroup customer = item as IGroup; if (!string.IsNullOrEmpty(_filterString) && SearchProperties != null && SearchProperties.Any()) { return(SearchProperties.Any(x => (item.GetType().GetProperty(x).GetValue(item)?.ToString().ToLower() ?? string.Empty).Contains(_filterString.ToLower()))); } return(true); }
public UIDemand2DocMicrosoftWWindow() { #region Search Criteria SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, " - Microsoft Word Viewer", PropertyExpressionOperator.Contains)); SearchProperties[UITestControl.PropertyNames.ClassName] = "OpusApp"; #endregion }
public void CleanSearchTermTest(string searchTerm, string expected, bool?shouldUseRaw) { SearchProperties properties = shouldUseRaw == true ? new SearchProperties { UseRawSearchTerm = true } : null; var testObject = new DfcSearchQueryBuilder(); var result = testObject.EscapeSpecialCharactersInSearchTerm(searchTerm, properties); result.Should().Be(expected); }
public void RemoveSpecialCharactersFromTheSearchTerm(string searchTerm, string expected, bool shouldUseRaw) { SearchProperties properties = shouldUseRaw ? new SearchProperties { UseRawSearchTerm = true } : null; var testObject = new DfcSearchQueryBuilder(); var result = testObject.RemoveSpecialCharactersFromTheSearchTerm(searchTerm, properties); result.Should().Be(expected); }
public virtual Data.Model.SearchResult <T> Search(string searchTerm, SearchProperties properties) { var searchParam = queryConverter.BuildSearchParameters(properties); var result = indexClient.Documents.Search <T>(searchTerm, searchParam); var output = queryConverter.ConvertToSearchResult(result, properties); output.ComputedSearchTerm = searchTerm; output.SearchParametersQueryString = searchParam.ToString(); return(output); }
public DDItemWindow() { #region Search Criteria SearchProperties[PropertyNames.AccessibleName] = "DropDown"; SearchProperties.Add(new PropertyExpression(PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains)); #endregion }
/// <summary> /// 指定した文字列でツイートを検索します /// </summary> /// <param name="query">検索したい文字列</param> /// <param name="resultStatuses">検索結果を格納するコレクション</param> /// <param name="prop">検索条件を定義したSearchPropertiesオブジェクト</param> /// <returns>検索結果を表すSearchResultオブジェクト</returns> public static SearchResult Search(this OAuth oauth, string query, out ICollection<Status> resultStatuses, SearchProperties prop = null) { var param = new List<KeyValuePair<string, string>>(); param.Add(new KeyValuePair<string, string>("q", query.UrlEncode())); if (prop == null) prop = new SearchProperties(); param.Add(new KeyValuePair<string, string>("count", prop.Count.ToString())); param.Add(new KeyValuePair<string, string>("lang", prop.Lang)); param.Add(new KeyValuePair<string, string>("result_type", prop.ResultType.ToString())); if (prop.SinceId > 0) param.Add(new KeyValuePair<string, string>("since_id", prop.SinceId.ToString())); if (prop.MaxId > 0) param.Add(new KeyValuePair<string, string>("max_id", prop.MaxId.ToString())); if (prop.Until == new DateTime(0)) param.Add(new KeyValuePair<string, string>("until", prop.Until.ToHyphenSeparatedShortDateString().UrlEncode())); var url = TwitterApiUrl + "search/tweets.json"; var json = oauth.RequestAPI(url, OAuth.RequestMethod.GET, param); resultStatuses = new List<Status>(); foreach (var el in (dynamic[])json["statuses"]) { resultStatuses.Add(Status.Create(el)); } return SearchResult.Create(json["search_metadata"]); }