/// <summary> /// Extracts a list of <see cref="HqlCondition"/> objects from the specified <see cref="SearchCriteria"/> /// </summary> /// <param name="qualifier">The HQL qualifier to prepend to the criteria variables</param> /// <param name="criteria">The search criteria object</param> /// <param name="remapHqlExprFunc"></param> /// <returns>A list of HQL conditions that are equivalent to the search criteria</returns> public static HqlCondition[] FromSearchCriteria(string qualifier, SearchCriteria criteria, Converter<string, string> remapHqlExprFunc) { var hqlConditions = new List<HqlCondition>(); if (criteria is SearchConditionBase) { var sc = (SearchConditionBase)criteria; if (sc.Test != SearchConditionTest.None) { hqlConditions.Add(GetCondition(remapHqlExprFunc(qualifier), sc.Test, sc.Values)); } } else { // recur on subCriteria foreach (var subCriteria in criteria.EnumerateSubCriteria()) { // use a different syntax for "extended properties" than regular properties var subQualifier = criteria is ExtendedPropertiesSearchCriteria ? string.Format("{0}['{1}']", qualifier, subCriteria.GetKey()) : string.Format("{0}.{1}", qualifier, subCriteria.GetKey()); hqlConditions.AddRange(FromSearchCriteria(subQualifier, subCriteria, remapHqlExprFunc)); } } return hqlConditions.ToArray(); }
public void CriteriaSearch() { var criteria = new SearchCriteria(); using (var session = TubsDataService.GetStatelessSession()) { var results = TubsDataService.Search(session, criteria); Assert.NotNull(results); Assert.AreEqual(0, results.Count()); criteria.Observer = "DJB"; // Dave Burgess, not a real observer. results = TubsDataService.Search(session, criteria); Assert.NotNull(results); Assert.Greater(results.Count(), 4); // Currently 6, but that changes criteria.ProgramCode = "PGOB"; results = TubsDataService.Search(session, criteria); Assert.GreaterOrEqual(results.Count(), 1); criteria.ProgramCode = String.Empty; criteria.Vessel = "TUNA"; results = TubsDataService.Search(session, criteria); Assert.Greater(results.Count(), 5); criteria.Vessel = String.Empty; criteria.AnyDate = new DateTime(2011, 9, 10); results = TubsDataService.Search(session, criteria); Assert.Greater(results.Count(), 1); } }
public void Execute_Should_Return_Product_Having_ItemAttributes_When_ResponseGroups_Contains_ItemAttributes() { // Arrange const string brand = "brand"; const string title = "title"; const string productGroup = "productGroup"; var detailsPageUrl = new Uri("http://www.amazon.com"); var customerReviewsUrl = new Uri("http://www.amazon.com"); var element = XElementFactory.Create("", title, productGroup, brand, detailsPageUrl, customerReviewsUrl); var searchCriteria = new SearchCriteria { ResponseGroups = new[] { "ItemAttributes" } }; var filter = new ItemAttributesProductPipelineFilter(); // Act var product = filter.Execute(new Product(), element, searchCriteria); // Assert product.Brand.Should().Be(brand); product.Title.Should().Be(title); product.ProductGroup.Should().Be(productGroup); product.DetailsPageUrl.Should().Be(detailsPageUrl); product.CustomerReviewsUrl.Should().Be(customerReviewsUrl); }
public IDictionary<string, string> BuildArgs(SearchCriteria searchCriteria) { DateTime now = _dateTimeProvider.GetNow(); string timestamp = _dateTimeProvider.Format(now); string associateTag = _generator.Generate(); var dic = new Dictionary<string, string> { { "Service", "AWSECommerceService" }, { "AWSAccessKeyId", _awsOptions.AccessKey }, { "AssociateTag", associateTag }, { "Operation", searchCriteria.Operation }, { "SearchIndex", searchCriteria.SearchIndex }, { "ResponseGroup", String.Join(",", searchCriteria.ResponseGroups ?? Enumerable.Empty<string>()) }, { "BrowseNode", searchCriteria.BrowseNode?.ToString(CultureInfo.InvariantCulture) ?? String.Empty }, { "BrowseNodeId", searchCriteria.BrowseNodeId?.ToString(CultureInfo.InvariantCulture) ?? String.Empty }, { "IdType", searchCriteria.IdType }, { "ItemId", searchCriteria.ItemId }, { "ItemPage", searchCriteria.ItemPage?.ToString(CultureInfo.InvariantCulture) }, { "Condition", searchCriteria.Condition ?? "All" }, { "Timestamp", timestamp } }; // Ordering parameters in naturual byte order as required by AWS return new SortedDictionary<string, string>(dic, StringComparer.Ordinal); }
/// <summary> /// Applies a SearchCriteria to the index. /// </summary> /// <param name="crit">The SearchCriteria to apply.</param> /// <returns>A ResultsTable that contains the result of applying the criteria.</returns> public ResultsTable GenerateResultsTable(SearchCriteria crit) { Debug.Assert(crit != null); CodeElementWrapperArrayIndexTable idxTable; // If using all criteria, perform a copy. if (crit.ElementFilter == CodeElementType.All) { idxTable = (CodeElementWrapperArrayIndexTable) indexTable.Clone(); } else { idxTable = new CodeElementWrapperArrayIndexTable(codeElementArray); for (int i = 0; i < codeElementArray.Count; i++) { if (codeElementArray[i].ElementType == crit.ElementFilter) { idxTable.Add(i); } } idxTable.Sort(new SortCriteria(SortCriteria.SortType.ALPHA)); } var ret = new ResultsTable(idxTable); return (ret); }
public void ShouldSupportPaging() { var criteria = new SearchCriteria<TestEntity>(); criteria.PageBy(2, 25); Assert.AreEqual(2, criteria.PageNumber); Assert.AreEqual(25, criteria.PageSize); }
/// <summary> /// Adds a new <see cref="Core.Model.SearchCriteria"/> to the collection of Searches. /// </summary> /// <param name="criteria">The Search Criteria to be added</param> /// <returns>The UniqueId of the search just added</returns> public string AddSearch(SearchCriteria criteria) { int lastId = GetLastId(); criteria.UniqueId = ++lastId; _unitOfWork.Searches.Add(criteria); return criteria.UniqueId.ToString(); }
public void ShouldAllowAddingOfCriteria() { var criteria = new SearchCriteria<TestEntity>(); criteria.Add(entity => entity.Id.HasValue); var list = new List<Expression<Func<TestEntity, bool>>>(criteria.All); Assert.IsTrue(list.Count == 1); Assert.AreEqual("entity.Id.HasValue", list[0].Body.ToString()); }
protected IEnumerable<CourtCaseHeading> GetAllCourtCases(SearchCriteria criteria) { List<CourtCaseHeading> output = this.CallServiceGet<List<FACCTS.Server.Model.Calculations.CourtCaseHeading>>(string.Format("{0}?{1}", Routes.GetCourtCases.CourtCaseController, criteria.ToString())) .Select(x => new CourtCaseHeading(x)) .ToList(); return output; }
public ISearchQuery SetCriteria(SearchCriteria criteria) { if (criteria == null) { _criteria = SearchCriteria.Empty; } _criteria = criteria; return this; }
public JsonResult GetBorrows(SearchCriteria[] searchCriteria, SortOrder[] sort, int page, int pageSize) { var dao = new BorrowService(); int count; List<Borrow> list = dao.GetBorrows(searchCriteria, sort, page, pageSize, out count); var borrows = AutoMapper.Mapper.Map<List<Borrow>, List<BorrowLiteModel>>(list); return Json(new { Borrows = borrows, Count = count }); }
/// <summary> /// Static <c>Map</c> method maps a <see cref="Core.Model.SearchCriteria"/> class to a /// <see cref="THLibrary.DataModel.SearchViewModel"/> class. /// </summary> /// <param name="criteria">The SearchCriteria instance.</param> /// <returns>The SearchViewModel instance.</returns> public static SearchViewModel Map(SearchCriteria criteria) { SearchViewModel searchVM = new SearchViewModel() { UniqueId = "", Type = Enum.GetName(typeof(SearchTypeEnum), criteria.Type), SearchString = criteria.SearchString, SearchDate = criteria.SearchDate.ToString() }; return searchVM; }
public static SearchCriteria FromString(string mixed) { if (mixed.IndexOf(Core.Keyword_ahk, StringComparison.OrdinalIgnoreCase) == -1) return new SearchCriteria { Title = mixed }; var criteria = new SearchCriteria(); var i = 0; var t = false; while ((i = mixed.IndexOf(Core.Keyword_ahk, i, StringComparison.OrdinalIgnoreCase)) != -1) { if (!t) { var pre = i == 0 ? string.Empty : mixed.Substring(0, i).Trim(Core.Keyword_Spaces); if (pre.Length != 0) criteria.Title = pre; t = true; } var z = mixed.IndexOfAny(Core.Keyword_Spaces, i); if (z == -1) break; var word = mixed.Substring(i, z - i); var e = mixed.IndexOf(Core.Keyword_ahk, ++i, StringComparison.OrdinalIgnoreCase); var arg = (e == -1 ? mixed.Substring(z) : mixed.Substring(z, e - z)).Trim(); long n; switch (word.ToLowerInvariant()) { case Core.Keyword_ahk_class: criteria.ClassName = arg; break; case Core.Keyword_ahk_group: criteria.Group = arg; break; case Core.Keyword_ahk_id: if (long.TryParse(arg, out n)) criteria.ID = new IntPtr(n); break; case Core.Keyword_ahk_pid: if (long.TryParse(arg, out n)) criteria.PID = new IntPtr(n); break; } i++; } return criteria; }
public Guid Search(SearchCriteria criteria, Guid existingSearchToken) { Guid token; if (existingSearchToken == Guid.Empty) token = Guid.NewGuid(); else token = existingSearchToken; _bus.Send(new SearchForProductMessage { SearchCorrelationToken = token }); return token; }
public SearchControl(ITATSystem itatSystem, bool showTerm1, bool showTerm2, bool showTerm3, bool showTerm4, bool showTerm5, bool showTerm6, bool showTerm7, SearchCriteria searchCriteria) { this._itatSystem = itatSystem; this._displayTerm1 = showTerm1; this._displayTerm2 = showTerm2; this._displayTerm3 = showTerm3; this._displayTerm4 = showTerm4; this._displayTerm5 = showTerm5; this._displayTerm6 = showTerm6; this._displayTerm7 = showTerm7; this._searchCriteria=searchCriteria; }
/// <summary> /// get a SearchCriteriaFormViewModel containing the criteria and the results of a search /// if results in cache /// get it /// else /// build searchcriteria from url /// with this, search matchings localisations in repository /// fill the session store with computed results /// and returns the results /// </summary> /// <param name="session">session to look up for results</param> /// <param name="parameters">parameters from which to build result of not in session</param> /// <returns>a object containing the criteria and the results of a search</returns> public SearchCriteriaFormViewModel FillSearchResults(SearchCriteria criteria) { var place = string.IsNullOrEmpty(criteria.Place) ? "" : criteria.Place.ToLower(); if (MiscHelpers.SeoConstants.Places.ContainsKey(place)) { var coor = MiscHelpers.SeoConstants.Places[place]; criteria.LocalisationData.Latitude = coor.Latitude; criteria.LocalisationData.Longitude = coor.Longitude; } var criteriaViewModel = new SearchCriteriaFormViewModel(criteria, true); FillResults(criteriaViewModel); return criteriaViewModel; }
public FlightSearchRequest(int adults, int children, int seniors, int infantsWithSeat, int infantsWithoutSeat, int youths, CabinClass cabinClass, string airline, bool flexibleDates, bool isDirect, SearchCriteria[] searchCriteria) : base(searchCriteria) { Adults = adults; Children = children; Seniors = seniors; InfantsWithSeat = infantsWithSeat; InfantsWithoutSeat = infantsWithoutSeat; Youths = youths; CabinClass = cabinClass; Airline = airline; FlexibleDates = flexibleDates; ProductType = ProductType.Flight; SearchCriteria = searchCriteria; FindFlightSearchRequestType(); }
public static Dictionary<ISearchable, List<SearchResult>> Search(List<ISearchable> searchables, string input, SearchCriteria criteria) { Dictionary<ISearchable, List<SearchResult>> results = new Dictionary<ISearchable, List<SearchResult>>(); foreach (ISearchable searchable in searchables) { List<SearchResult> fileResults = searchable.Search(input, criteria); if (results.Count > 0) { results.Add(searchable, fileResults); } } return results; }
public void BuildUrl_Should_Pass_SearchCriteria_To_ArgumentBuilder_BuildArgs() { // Arrange var searchCriteria = new SearchCriteria(); var argumentBuilder = new Mock<IArgumentBuilder>(); argumentBuilder.Setup(b => b.BuildArgs(searchCriteria)).Returns(new Dictionary<string, string>()); IUrlBuilder urlBuilder = CreateUrlBuilder(argumentBuilder.Object); // Act urlBuilder.BuildUrl(searchCriteria); // Assert argumentBuilder.VerifyAll(); }
public virtual ActionResult FullSearch(SearchCriteria criteria) { if (ModelState.IsValid) { try { var rvd = _SearchService.GetRVD(criteria); return RedirectToAction(MVC.Localisation.Actions.ActionNames.FullSearchResult, rvd); } catch (Exception ex) { _Logger.Error("FullSearch", ex); ModelState.AddModelError("", Worki.Resources.Validation.ValidationString.CheckCriterias); } } return View(MVC.Mobile.Home.Views.index, new SearchCriteriaFormViewModel(criteria)); }
public ActionResult Index(SearchCriteria? searchCriteria, string searchText) { searchText = searchText.Trim(); switch (searchCriteria) { case SearchCriteria.All: return this.RedirectToAction(x => x.All(searchText)); case SearchCriteria.Genre: return this.RedirectToAction(x => x.Genre(searchText)); case SearchCriteria.Title: return this.RedirectToAction(x => x.Title(searchText)); case SearchCriteria.Actor: return this.RedirectToAction(x => x.Actor(searchText)); default: return new HttpNotFoundResult(); } }
public virtual ActionResult AjaxSearch(SearchCriteria criteria) { if (ModelState.IsValid) { try { var criteriaViewModel = _SearchService.FillSearchResults(criteria); return GetSearchResult(criteriaViewModel); } catch (Exception ex) { _Logger.Error("AjaxSearch", ex); ModelState.AddModelError("", Worki.Resources.Validation.ValidationString.CheckCriterias); throw new ModelStateException(ModelState); } } throw new ModelStateException(ModelState); }
public void Execute_Should_Return_Product_Having_Images_When_ResponseGroups_Contains_Images() { // Arrange var largeImageUrl = new Uri("http://www.amazon.com"); const int imagesCount = 3; var element = XElementFactory.Create(largeImageUrl: largeImageUrl, imagesCount: imagesCount); var searchCriteria = new SearchCriteria { ResponseGroups = new[] { "Images" } }; var filter = new ImagesProductPipelineFilter(); // Act var product = filter.Execute(new Product(), element, searchCriteria); // Assert product.LargeImageUrl.Should().Be(largeImageUrl); product.ImagesCount.Should().Be(imagesCount); }
public void Execute_Should_Return_Product_Having_OfferSummary_When_ResponseGroups_Contains_OfferSummary() { // Arrange const int lowestNewPrice = 255; const int offersCount = 5; var element = XElementFactory.Create(lowestNewPrice: lowestNewPrice, offersCount: offersCount); var searchCriteria = new SearchCriteria { ResponseGroups = new[] { "OfferSummary" } }; var filter = new OfferSummaryProductPipelineFilter(); // Act var product = filter.Execute(new Product(), element, searchCriteria); // Assert product.LowestNewPrice.Should().Be(lowestNewPrice); product.OffersCount.Should().Be(offersCount); }
public IHttpActionResult GetCategoryByCode(string store, [FromUri] string code, string language = "en-us") { var catalog = GetStoreById(store).Catalog; var searchCriteria = new SearchCriteria { ResponseGroup = ResponseGroup.WithCategories, Code = code, CatalogId = catalog }; var result = _searchService.Search(searchCriteria); if (result.Categories != null && result.Categories.Any()) { var category = _categoryService.GetById(result.Categories.First().Id); if (category != null) { return Ok(category.ToWebModel(_blobUrlResolver)); } } return NotFound(); }
public void SetControlPreSelects(SearchCriteria searchCriteria) { string field1 = null; string field2 = null; _systemTermControls = Helper.CreateSearchControls(_itatSystem.Terms, true, new Business.SecurityHelper(_itatSystem)); foreach (Business.Term term in _itatSystem.Terms) { if (term.Runtime.Visible) { switch (term.TermType) { case Business.TermType.Text: case Business.TermType.MSO: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2, searchCriteria); SetTextBoxText(_systemTermControls[term.Name], field1); break; case Business.TermType.Date: case Business.TermType.Renewal: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2, searchCriteria); SetDateRangeText(_systemTermControls[term.Name], field1, field2); break; case Business.TermType.Facility: if (searchCriteria.FacilityIds != null) if (searchCriteria.FacilityIds.Count == 1) SetDropDownList(_systemTermControls[term.Name], searchCriteria.FacilityIds[0].ToString()); break; case Business.TermType.PickList: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2, searchCriteria); SetDropDownList(_systemTermControls[term.Name], field1); break; } } } }
protected override Expression VisitMethodCall(MethodCallExpression node) { if (node.Method.Name == "Take") { this.criteria = new SearchCriteria(); } else if (node.Method.Name == "Where") { Type[] genericArguments = node.Method.GetGenericArguments(); if (genericArguments.Length == 1 && genericArguments[0] == typeof(Person)) { return node.Update( node.Object, new Expression[] { Visit(node.Arguments[0]), Expression.Quote(VisitWhereClause((LambdaExpression)((UnaryExpression)(node.Arguments[1])).Operand)) }); } } return base.VisitMethodCall(node); }
public void ThenIShouldSeeTheWishForm() { Button button = window.Get <Button>(SearchCriteria.ByAutomationId("AddWish")); Assert.IsTrue(button.Visible); }
public virtual IUIItem Get(SearchCriteria searchCriteria, IActionListener actionListener) { return(Get(searchCriteria, actionListener, dictionaryMappedItemFactory)); }
public IWindowFixture Into(string id) { return(Into(SearchCriteria.ByAutomationId(id))); }
protected T GetByAutomationId <T>(string id) { return((T)MainWindow.Get(SearchCriteria.ByAutomationId(id))); }
//public SearchUnsuccessPage SearchUnsuccessfully(string searchText) public SearchUnsuccessPage SearchUnsuccessfully(SearchCriteria searchCriteria) { MakeTopSearch(searchCriteria.SearchValue); //MakeTopSearch(searchText); return(new SearchUnsuccessPage(driver)); }
protected T GetByClassName <T>(string className) where T : IUIItem { return((T)MainWindow.Get <T>(SearchCriteria.ByClassName(className))); }
private IEnumerable <Parameter> CreateParameters(SearchCriteria criteria, int page) { var result = new List <Parameter>(); if (criteria == null) { return(result); } if (criteria.Translation || criteria.Interpreting || criteria.Potential) { var value = new StringBuilder(); if (criteria.Translation) { value.Append(value.Length == 0 ? "translation" : ",translation"); } if (criteria.Interpreting) { value.Append(value.Length == 0 ? "interpret" : ",interpret"); } if (criteria.Potential) { value.Append(value.Length == 0 ? "potential" : ",potential"); } var typeParameter = new Parameter { Type = ParameterType.QueryString, Value = value.ToString(), Name = "type" }; result.Add(typeParameter); } if (criteria.LanguagePair.Source.LanguageCode != "all" && criteria.LanguagePair.Target.LanguageCode != "all") { var languagePairParameter = new Parameter { Type = ParameterType.QueryString, Value = criteria.LanguagePair.Serialize(), Name = "language_pairs" }; result.Add(languagePairParameter); } if (criteria.Discipline.DiscSpecId != 0) { var disciplineParameter = new Parameter { Type = ParameterType.QueryString, Value = criteria.Discipline.DiscSpecId, Name = "disc_spec_ids" }; result.Add(disciplineParameter); } if (!string.IsNullOrEmpty(criteria.SearchTerm)) { var searchParameter = new Parameter { Type = ParameterType.QueryString, Value = criteria.SearchTerm, Name = "q" }; result.Add(searchParameter); } var pageParameter = new Parameter { Type = ParameterType.QueryString, Value = page, Name = "page" }; result.Add(pageParameter); return(result); }
private async Task <IEnumerable <KeyValuePair <string, string> > > HandleSearch(Headers sparams, User user, string deviceId) { var searchCriteria = new SearchCriteria(sparams.GetValueOrDefault("SearchCriteria", "")); var sortCriteria = new SortCriteria(sparams.GetValueOrDefault("SortCriteria", "")); var filter = new Filter(sparams.GetValueOrDefault("Filter", "*")); // sort example: dc:title, dc:date // Default to null instead of 0 // Upnp inspector sends 0 as requestedCount when it wants everything int?requestedCount = null; int?start = 0; int requestedVal; if (sparams.ContainsKey("RequestedCount") && int.TryParse(sparams["RequestedCount"], out requestedVal) && requestedVal > 0) { requestedCount = requestedVal; } int startVal; if (sparams.ContainsKey("StartingIndex") && int.TryParse(sparams["StartingIndex"], out startVal) && startVal > 0) { start = startVal; } //var root = GetItem(id) as IMediaFolder; var result = new XmlDocument(); var didl = result.CreateElement(string.Empty, "DIDL-Lite", NS_DIDL); didl.SetAttribute("xmlns:dc", NS_DC); didl.SetAttribute("xmlns:dlna", NS_DLNA); didl.SetAttribute("xmlns:upnp", NS_UPNP); foreach (var att in _profile.XmlRootAttributes) { didl.SetAttribute(att.Name, att.Value); } result.AppendChild(didl); var serverItem = GetItemFromObjectId(sparams["ContainerID"], user); var item = serverItem.Item; var childrenResult = (await GetChildrenSorted(item, user, searchCriteria, sortCriteria, start, requestedCount).ConfigureAwait(false)); var totalCount = childrenResult.TotalRecordCount; var provided = childrenResult.Items.Length; foreach (var i in childrenResult.Items) { if (i.IsFolder) { var childCount = (await GetChildrenSorted(i, user, searchCriteria, sortCriteria, null, 0).ConfigureAwait(false)) .TotalRecordCount; result.DocumentElement.AppendChild(_didlBuilder.GetFolderElement(result, i, null, item, childCount, filter)); } else { result.DocumentElement.AppendChild(_didlBuilder.GetItemElement(result, i, item, serverItem.StubType, deviceId, filter)); } } var resXML = result.OuterXml; return(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("Result", resXML), new KeyValuePair <string, string>("NumberReturned", provided.ToString(_usCulture)), new KeyValuePair <string, string>("TotalMatches", totalCount.ToString(_usCulture)), new KeyValuePair <string, string>("UpdateID", _systemUpdateId.ToString(_usCulture)) }); }
public void getWin(Window rptWin1) { rptWin = rptWin1.Get <Panel>(SearchCriteria.ByAutomationId("ppFlyout")); }
/// <summary> /// Clears the filters and displays the hierarchical TreeView. /// </summary> public void ResetFilters() { _searchCriteria = new SearchCriteria(CodeElementType.All); if (_currentDocument != null) { _currentFilterText = ""; _currentResults = _codeElementWrapperIndexTable.GenerateResultsTable(_searchCriteria); ViewType = ViewType.TreeView; _control.Reset(); } }
public void AndTheButtonShouldBeDisabled(string buttonContent) { Button button = window.Get <Button>(SearchCriteria.ByText(buttonContent)); Assert.IsFalse(button.Enabled); }
public void WhenIClick(string buttonContent) { Button button = window.Get <Button>(SearchCriteria.ByText(buttonContent)); button.Click(); }
public virtual T Get <T>(SearchCriteria searchCriteria, IActionListener actionListener) where T : UIItem { return(Get <T>(searchCriteria, actionListener, dictionaryMappedItemFactory)); }
public void openAndRunAvi2() { var app = Application.Launch("KinectWin10.exe"); var window = app.GetWindow("Kinect Skeleton Analyst", InitializeOption.NoCache); var label = window.Get <Label>("labelKosciec2"); Assert.IsTrue(label.Text == ""); var uploadButton = window.Get <Button>("uploadAvi2_Button"); uploadButton.Click(); string tests_dir = Directory.GetCurrentDirectory(); var openModalWindow = window.ModalWindow("Open", InitializeOption.NoCache); window.WaitWhileBusy(); Assert.IsNotNull(openModalWindow); var filePath = Path.Combine(tests_dir, "..", "..", "..", "..", "clipKosciec.avi"); var filenameTextBox = openModalWindow.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); filenameTextBox.SetValue(filePath); openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN); var startButton = window.Get <Button>("startKosciec2"); var pauseButton = window.Get <Button>("pauseKosciec2"); var stop = window.Get <Button>("stopKosciec2"); Assert.AreEqual(label.Text, "Nacisnij start"); startButton.Click(); System.Threading.Thread.Sleep(2000); Assert.AreNotEqual(label.Text, "Nacisnij start"); var time1 = label.Text; System.Threading.Thread.Sleep(2000); Assert.AreNotEqual(label.Text, time1); pauseButton.Click(); System.Threading.Thread.Sleep(1000); var time2 = label.Text; System.Threading.Thread.Sleep(1000); Assert.AreEqual(label.Text, time2); startButton.Click(); System.Threading.Thread.Sleep(1000); var time3 = label.Text; System.Threading.Thread.Sleep(1000); Assert.AreNotEqual(label.Text, time3); stop.Click(); System.Threading.Thread.Sleep(1000); var time4 = label.Text; System.Threading.Thread.Sleep(1000); Assert.AreEqual(label.Text, time4); app.Close(); }
public virtual Menu Find(string text) { return(Find(SearchCriteria.ByText(text))); }
private UIItemCollection GetAll(SearchCriteria searchCriteria, IActionListener actionListener, IUIItemFactory factory) { List <AutomationElement> automationElements = searchCriteria.Filter(list); return(new UIItemCollection(automationElements.ToArray(), factory, actionListener)); }
public static Panel Get(SearchCriteria searchCriteria, string itemName, Window window = null) { return(new Panel(Find(searchCriteria, window), $"Panel: {itemName}")); }
public async Task FilterWorlds() { await Task.Run(() => { FilteredWorlds = string.IsNullOrEmpty(SearchCriteria) || Worlds == null ? Worlds : Worlds.Where(x => x.Name.ToLower().Contains(SearchCriteria.ToLower())); }); }
public static bool LoginSISCOBWhite(string User, string Pass) { //Carrega o numero do ramal das configurações do 3cx IniFile ramalConfig = new IniFile(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\AppData\Local\3CX VoIP Phone\3CXVoipPhone.ini"); int profile = 0; String ramal = ""; while (true) { if (ramalConfig.KeyExists("CallerID", "Profile" + profile.ToString())) { if (ramalConfig.Read("Enabled", "Profile" + profile.ToString()).Equals("1")) { ramal = ramalConfig.Read("CallerID", "Profile" + profile.ToString()); break; } } else { break; } profile++; } var appLauncher = TestStack.White.Application.Launch(@"C:\Program Files\CSLog\Cobranca2\startsiscob.exe"); while (Process.GetProcessesByName("cobdesk").Count() == 0) { Thread.Sleep(100); } var app2 = TestStack.White.Application.Attach("cobdesk"); var mainWindow = app2.GetWindow("Login CSLog"); var txtLogin = mainWindow.Get(SearchCriteria.ByClassName("TEditCob")); txtLogin.SetValue(User); var txtSenha = mainWindow.Get(SearchCriteria.ByClassName("TMaskEditCob")); txtSenha.SetValue(Pass); var btnEnter = mainWindow.Get(SearchCriteria.ByText("[Ctrl + Enter]")); btnEnter.Click(); Thread.Sleep(500); try { mainWindow.Get(SearchCriteria.ByClassName("TMaskEditCob")); Logger.LoginSicobError(); DialogResult result2 = MessageBox.Show("SENHA INCORRETA. RESTA(M) 2 TENTATIVA(S) PARA BLOQUEIO !!!", "Facilita", MessageBoxButtons.OK, MessageBoxIcon.Error); var loginCerto = TestStack.White.Application.Attach("cobdesk"); var ramalWindow = app2.GetWindow("Digite o seu Ramal:"); var txtRamal = ramalWindow.Get(SearchCriteria.ByClassName("TEditCob")); txtRamal.SetValue(ramal); Thread.Sleep(300); ramalWindow.Keyboard.PressSpecialKey(TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys.RETURN); return(true); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); var ramalWindow = app2.GetWindow("Digite o seu Ramal:"); var txtRamal = ramalWindow.Get(SearchCriteria.ByClassName("TEditCob")); txtRamal.SetValue(ramal); Thread.Sleep(300); ramalWindow.Keyboard.PressSpecialKey(TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys.RETURN); Thread.Sleep(1000); Ligacao(); //if (liga) // { // //Pronto chamada // //Task.Run(() => RetornarLigacao()); // } return(true); } }
public static void Ligacao() { var app2 = TestStack.White.Application.Attach("cobdesk"); try { var windows = app2.GetWindows(); foreach (var wind in windows) { if (wind.Name.Contains("cslog_rr_prod")) { var chamada3cx = wind; var pronto = chamada3cx.Get(SearchCriteria.ByAutomationId("btnReady")); do { pronto.SetForeground(); pronto.Focus(); } while (!pronto.IsFocussed); Thread.Sleep(2000); pronto.Click(); Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); Thread.Sleep(2000); //ShowWindow(getProcess("3CXPhone").MainWindowHandle, SW_MINIMIZE); chamada3cx.Focus(); break; } } //esperar e detectar chamada int timeout1 = 0; do { var windows1 = app2.GetWindows(); foreach (var wind1 in windows1) { if (wind1.Name.Contains("Chamada DISCADOR")) { var discador = wind1; //Identifica Ativo/Receptivo var txtsAtendimento = wind1.GetMultiple <TestStack.White.UIItems.TextBox>(SearchCriteria.ByControlType(ControlType.Edit)); //Identifica Ativo/Receptivo //var txtCpf = discador.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("txtUserDefined14")); var fechar = discador.Get(SearchCriteria.ByText("Fechar")); fechar.SetForeground(); fechar.Focus(); Thread.Sleep(100); fechar.Click(); Thread.Sleep(1500); if (txtsAtendimento.Count() > 16) { //iniciar tela registro receptivo TelaReg(true); } else { //iniciar tela registro ativo TelaReg(false); } timeout1 = 10000; break; } } timeout1++; Thread.Sleep(1000); } while (timeout1 <= 10000); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return; } }
public Button GetButton(string s) { Button flag = null; if (s == nameof(but1)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but1)); } else if (s == nameof(but2)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but2)); } else if (s == nameof(but3)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but3)); } else if (s == nameof(but4)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but4)); } else if (s == nameof(but5)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but5)); } else if (s == nameof(but6)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but6)); } else if (s == nameof(but7)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but7)); } else if (s == nameof(but8)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but8)); } else if (s == nameof(but9)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but9)); } else if (s == nameof(but0)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(but0)); } else if (s == nameof(butMinus)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(butMinus)); } else if (s == nameof(butPlus)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(butPlus)); } else if (s == nameof(butDiv)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(butDiv)); } else if (s == nameof(butEqual)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(butEqual)); } else if (s == nameof(butMult)) { flag = window.Get <Button>(SearchCriteria.ByAutomationId(butMult)); } return(flag); }
public void openAndRunBothKosciecSimultaneously() { var app = Application.Launch("KinectWin10.exe"); var window = app.GetWindow("Kinect Skeleton Analyst", InitializeOption.NoCache); var label1 = window.Get <Label>("labelKosciec1"); var label2 = window.Get <Label>("labelKosciec2"); Assert.IsTrue(label1.Text == ""); Assert.IsTrue(label2.Text == ""); var uploadButton1 = window.Get <Button>("uploadSkeleton1_Button"); uploadButton1.Click(); string tests_dir = Directory.GetCurrentDirectory(); var openModalWindow = window.ModalWindow("Open", InitializeOption.NoCache); window.WaitWhileBusy(); Assert.IsNotNull(openModalWindow); var filePath = Path.Combine(tests_dir, "..", "..", "..", "..", "Kosciec.kosciec"); var filenameTextBox = openModalWindow.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); filenameTextBox.SetValue(filePath); openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN); var uploadButton2 = window.Get <Button>("uploadSkeleton2_Button"); uploadButton2.Click(); tests_dir = Directory.GetCurrentDirectory(); openModalWindow = window.ModalWindow("Open", InitializeOption.NoCache); window.WaitWhileBusy(); Assert.IsNotNull(openModalWindow); filePath = Path.Combine(tests_dir, "..", "..", "..", "..", "Kosciec.kosciec"); filenameTextBox = openModalWindow.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); filenameTextBox.SetValue(filePath); openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN); var startButton = window.Get <Button>("startMovieAll"); var pauseButton = window.Get <Button>("pauseAll"); var stopAllButton = window.Get <Button>("stopAll"); Assert.AreNotEqual(label1.Text, ""); Assert.AreNotEqual(label2.Text, ""); startButton.Click(); System.Threading.Thread.Sleep(2000); Assert.AreNotEqual(label1.Text, "Nacisnij start"); Assert.AreNotEqual(label2.Text, "Nacisnij start"); var time1_1 = label1.Text; var time1_2 = label2.Text; System.Threading.Thread.Sleep(1000); Assert.AreNotEqual(label1.Text, time1_1); Assert.AreNotEqual(label2.Text, time1_2); pauseButton.Click(); System.Threading.Thread.Sleep(1000); var time2_1 = label1.Text; var time2_2 = label2.Text; System.Threading.Thread.Sleep(1000); Assert.AreEqual(label1.Text, time2_1); Assert.AreEqual(label2.Text, time2_2); startButton.Click(); System.Threading.Thread.Sleep(500); var time3_1 = label1.Text; var time3_2 = label2.Text; System.Threading.Thread.Sleep(1000); Assert.AreNotEqual(label1.Text, time3_1); Assert.AreNotEqual(label2.Text, time3_2); stopAllButton.Click(); System.Threading.Thread.Sleep(1000); var time4_1 = label1.Text; var time4_2 = label2.Text; System.Threading.Thread.Sleep(1000); Assert.AreEqual(label1.Text, time4_1); Assert.AreEqual(label2.Text, time4_2); app.Close(); }
public virtual UIItemCollection GetAll(SearchCriteria searchCriteria, IActionListener actionListener) { return(GetAll(searchCriteria, actionListener, dictionaryMappedItemFactory)); }
void timer_Tick(object sender, EventArgs e) { var app2 = TestStack.White.Application.Attach("cobdesk"); int timeout1 = 0; var windows1 = app2.GetWindows(); foreach (var wind1 in windows1) { if (wind1.Name.Contains("Chamada DISCADOR")) { var discador = wind1; //Identifica Ativo/Receptivo //var txtCpf = discador.Get<TestStack.White.UIItems.TextBox>(SearchCriteria.ByAutomationId("txtUserDefined14")); var txtsAtendimento = wind1.GetMultiple <TestStack.White.UIItems.TextBox>(SearchCriteria.ByControlType(ControlType.Edit)); var fechar = discador.Get(SearchCriteria.ByText("Fechar")); fechar.SetForeground(); fechar.Focus(); Thread.Sleep(100); fechar.Click(); Thread.Sleep(1500); if (txtsAtendimento.Count() > 16) { //iniciar tela registro receptivo Siscob.TelaReg(true); } else { //iniciar tela registro ativo Siscob.TelaReg(false); } timeout1 = 10000; break; } } Console.WriteLine(timeout1++); Thread.Sleep(1000); }
private async Task <QueryResult <BaseItem> > GetChildrenSorted(BaseItem item, User user, SearchCriteria search, SortCriteria sort, int?startIndex, int?limit) { var folder = (Folder)item; var sortOrders = new List <string>(); if (!folder.IsPreSorted) { sortOrders.Add(ItemSortBy.SortName); } var mediaTypes = new List <string>(); bool?isFolder = null; if (search.SearchType == SearchType.Audio) { mediaTypes.Add(MediaType.Audio); isFolder = false; } else if (search.SearchType == SearchType.Video) { mediaTypes.Add(MediaType.Video); isFolder = false; } else if (search.SearchType == SearchType.Image) { mediaTypes.Add(MediaType.Photo); isFolder = false; } else if (search.SearchType == SearchType.Playlist) { //items = items.OfType<Playlist>(); isFolder = true; } else if (search.SearchType == SearchType.MusicAlbum) { //items = items.OfType<MusicAlbum>(); isFolder = true; } return(await folder.GetItems(new InternalItemsQuery { Limit = limit, StartIndex = startIndex, SortBy = sortOrders.ToArray(), SortOrder = sort.SortOrder, User = user, Recursive = true, Filter = FilterUnsupportedContent, IsFolder = isFolder, MediaTypes = mediaTypes.ToArray() }).ConfigureAwait(false)); }
public void getSavedReport() { rptWin.Get <TreeNode>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "My Reports")).Click(); }
/// <summary> /// Filter catalog search criteria based on current user permissions /// </summary> /// <param name="criteria"></param> /// <returns></returns> protected void ApplyRestrictionsForCurrentUser(SearchCriteria criteria) { var userName = User.Identity.Name; criteria.ApplyRestrictionsForUser(userName, _securityService); }
void FillListBox() { IstextChanged = true; DataTable Dt = null; SearchCriteria objSearch = new SearchCriteria(); objSearch.Query = _Query; objSearch.WhereString = _Where; objSearch.SearchOn = _FilterCol; objSearch.SearchValue = this.Text; objSearch.MaximumRows = PageSize; objSearch.IsMoveUp = false; if (valueSelected) { objSearch.SelectedValueQuery = "select @SearchValue=" + _FilterCol + " from " + strTable + " where " + strPrimaryKey + " = " + this.SelectedValue.ToString(); valueSelected = false; } CommonClient oDMCommon = new CommonClient(); Dt = oDMCommon.GetDataTable_Search(objSearch, CompanyDBIndex.ToString()); oDMCommon.Close(); if (Dt != null && Dt.Rows.Count > 0) { if (this.ItemsSource == null) { this.ItemsSource = Dt.AsDataView(); ((DataView)this.ItemsSource).Table.PrimaryKey = new DataColumn[] { ((DataView)this.ItemsSource).Table.Columns[0] }; } else { Dt.PrimaryKey = new DataColumn[] { Dt.Columns[0] }; for (int i = 0; i < ((DataView)this.ItemsSource).Table.Rows.Count; i++) { if (!Dt.Rows.Contains(((DataView)this.ItemsSource).Table.Rows[i][0])) { ((DataView)this.ItemsSource).Table.Rows.RemoveAt(i); i--; } } for (int i = 0; i < Dt.Rows.Count; i++) { if (((DataView)this.ItemsSource).Table.Rows.Contains(Dt.Rows[i][0])) { continue; } DataRow dr = ((DataView)this.ItemsSource).Table.NewRow(); for (int j = 0; j < ((DataView)this.ItemsSource).Table.Columns.Count; j++) { dr[j] = Dt.Rows[i][j]; } if (((DataView)this.ItemsSource).Table.Rows.Count == i) { ((DataView)this.ItemsSource).Table.Rows.Add(dr); } else { ((DataView)this.ItemsSource).Table.Rows.InsertAt(dr, i); } } //if (popupDataGrid.Items.Count > 0) // popupDataGrid.SelectedItem = popupDataGrid.Items[0]; } } IstextChanged = false; }
public void ThenIShouldNotSeeTheWishCompForm() { Button button = window.Get <Button>(SearchCriteria.ByAutomationId("AddWishComp")); Assert.IsFalse(button.Visible); }
public virtual T Get <T>(SearchCriteria searchCriteria, IActionListener actionListener, IUIItemFactory factory) where T : UIItem { return((T)Get(searchCriteria.AndControlType(typeof(T), WindowsFramework.None), actionListener, factory)); }
/// <summary> /// Initializes a new instance of the CodeOutlineFileManager class. /// </summary> /// <param name="control">The outline control object.</param> /// <param name="dte">A DTE object exposing the Visual Studio automation object model.</param> /// <param name="d">The source file Document.</param> /// <param name="toolWindow">The tool window for the package.</param> public CodeOutlineFileManager(SourceOutlinerControl control, EnvDTE.DTE dte, Document d, SourceOutlinerToolWindow toolWindow) { _control = control; _dte = dte; _sourceOutlinerToolWindow = toolWindow; _viewType = ViewType.TreeView; _searchCriteria = new SearchCriteria(CodeElementType.All); _currentFilterText = ""; _currentDocument = d; _codeTreeView = new System.Windows.Forms.TreeView(); _codeFilterView = new System.Windows.Forms.TreeView(); // // _codeTreeView // _codeTreeView.Dock = System.Windows.Forms.DockStyle.Fill; _codeTreeView.HideSelection = false; _codeTreeView.Location = new System.Drawing.Point(0, 45); _codeTreeView.Name = "codeTreeView"; _codeTreeView.ShowNodeToolTips = true; _codeTreeView.Size = new System.Drawing.Size(352, 294); _codeTreeView.TabIndex = 2; // // _codeFilterView // _codeFilterView.Dock = System.Windows.Forms.DockStyle.Fill; _codeFilterView.HideSelection = false; _codeFilterView.Location = new System.Drawing.Point(0, 45); _codeFilterView.Name = "codeFilterView"; _codeFilterView.ShowNodeToolTips = true; _codeFilterView.Size = new System.Drawing.Size(352, 294); _codeFilterView.TabIndex = 3; _codeFilterView.Visible = false; _codeFilterView.ShowLines = false; _codeFilterView.ShowRootLines = false; _codeFilterView.FullRowSelect = true; }
public void AndIChooseTheEventDate(DateTime newDate) { DateTimePicker picker = window.Get <DateTimePicker>(SearchCriteria.ByAutomationId("EventDate")); picker.SetValue(newDate); }