public IEnumerator TriggerSearchWhenUserStopTyping() { const string searchValue = "Something"; const float idleTimeToTriggerSearch = SearchInputField.IDLE_TYPE_TIME_TRIGGER_SEARCH; bool searchTriggered = false; string searchValueReceived = ""; float searchTriggerTime = 0; var handler = Substitute.For <ISectionSearchHandler>(); handler.WhenForAnyArgs(a => a.SetSearchString("")) .Do(info => { searchTriggered = true; searchValueReceived = info.Arg <string>(); searchTriggerTime = Time.unscaledTime; }); view.SetSearchBar(handler, null); float searchTime = Time.unscaledTime; view.inputField.inputField.text = searchValue; yield return(new WaitForSeconds(idleTimeToTriggerSearch)); Assert.IsTrue(searchTriggered); Assert.AreEqual(searchValue, searchValueReceived); Assert.GreaterOrEqual(searchTriggerTime, searchTime + idleTimeToTriggerSearch); }
void OnSectionShow(SectionBase sectionBase) { if (sectionBase is IDeployedSceneListener deployedSceneListener) { scenesViewController.AddListener(deployedSceneListener); } if (sectionBase is IProjectSceneListener projectSceneListener) { scenesViewController.AddListener(projectSceneListener); } if (sectionBase is ISelectSceneListener selectSceneListener) { scenesViewController.AddListener(selectSceneListener); } if (sectionBase is ILandsListener landsListener) { landController.AddListener(landsListener); } searchBarView.SetSearchBar(sectionBase.searchHandler, sectionBase.searchBarConfig); }