示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 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);
         }
     }
 }