public static int[] FindNewsArticlesContaining(NewsItem[] newsItems, string[] terms, MatchType searchOperator) { List<int> foundItemsIndexes = new List<int>(); for(int i = 0; i < newsItems.Length; i++) { if (newsItems[i].Search(terms, searchOperator)) { foundItemsIndexes.Add(i); } } return foundItemsIndexes.ToArray(); }
public void TestSearch_WillReturnTrue_WhenCalledWithMatchingOrSearch() { NewsItem newsItem = new NewsItem("July 9 , 2013 : The HSCIC has extended the consultation period on a draft list of conditions to be included in a proposed ' Present on Admission flag ' . There are a number of conditions that , whilst preventable , can be acquired in hospitals and have an adverse effect on a patients morbidity and / or involve substantial financial cost to the hospital . Analysis of these conditions is currently difficult as it is not always known whether a condition has been acquired during the patients stay or was present at the time of admission to the hospital . If introduced a Present on admission flag could enable identification of conditions that were acquired by patients during their stay and those that existed prior to admission . This would enable better analysis of these conditions , helping to attribute the condition to the appropriate timeframe and in turn identify good practice . The Health and Social Care Information Centre ( HSCIC ) is working with key stakeholders , including the Academy of Medical Royal Colleges ( AoMRC ) , Royal College of Nursing ( RCN ) and Care Quality Commission ( CQC ) to define a candidate list of Present on Admission conditions and associated guidance . We are keen to hear from stakeholders , particularly clinicians and healthcare specialists . The consultation has now been extended until Sunday 28 July to enable as wide a range of stakeholders to respond as possible . "); bool found = newsItem.Search(new string[] { "list", "wibble", "foo" }, MatchType.Or); Assert.IsTrue(found); }