public void ShouldListAllItemsContainsAStringInTitleOrDescription() { Events newEvents = new Events { {new Event ( "2015/01/01", "#tag"," title description") }, {new Event("2015/11/15", "title","@desc") }, {new Event("2015/11/15","tag","@Ioana") }, {new Event("2015/11/15", "#tag","#desc tag @Ioana test" ) } }; Calendar.StringFilter eventsToFilter = new Calendar.StringFilter("||",new string[] { "title" } ); List<Event> expectedList = new List<Event> { {new Event ( "2015/01/01", "#tag"," title description") }, {new Event("2015/11/15", "title","@desc") } }; Events filteredList = eventsToFilter.ApplyFilter(newEvents); Utils.AssertAreEqual(filteredList, expectedList); }
public void ShouldListAllItemsContainsAStringInTitleOrDescription() { Events newEvents = new Events { { new Event("2015/01/01", "#tag", " title description") }, { new Event("2015/11/15", "title", "@desc") }, { new Event("2015/11/15", "tag", "@Ioana") }, { new Event("2015/11/15", "#tag", "#desc tag @Ioana test") } }; Calendar.StringFilter eventsToFilter = new Calendar.StringFilter("||", new string[] { "title" }); List <Event> expectedList = new List <Event> { { new Event("2015/01/01", "#tag", " title description") }, { new Event("2015/11/15", "title", "@desc") } }; Events filteredList = eventsToFilter.ApplyFilter(newEvents); Utils.AssertAreEqual(filteredList, expectedList); }
private void StartSearching() { { var values = textBoxSearch.Text.Split(' '); StringFilter filteredList = new StringFilter("||", values); this.displayedList = filteredList.ApplyFilter(eventsList); if (this.displayedList.Length > 0) { listView1.Items.Clear(); this.displayedList.Sort(); foreach (Event ev in this.displayedList) { AddAppointmentToListView(ev); } labelFiltered.Visible = true; linkLabel_Clear.Visible = true; listView1.Refresh(); } else { MessageBox.Show(string.Format("No records matching the current criteria were found!"), "No records found", MessageBoxButtons.OK); } } }