public void TestSearch() { Book book = new Book("book", new DateTime(2016, 12, 30), eBaseCategory.Study, eInnerCategory.Medicine, "author"); Journal journal = new Journal("journal", new DateTime(2016, 12, 20), eBaseCategory.Cooking, eInnerCategory.Desserts, 9); collection.Items.Add(book); collection.Items.Add(journal); var item = collection.FindItemByName("a"); Assert.AreEqual(1, item.Count); }
//Search the Library for Books and Journals by Item Name //and display the results in the DataGrid private void NameSearch(object sender, TextChangedEventArgs e) { //If we are in Regular Search Mode if (!IsMultiSearch) { //Search for the books by Item Name //and display the results in the DataGrid dataLib.ItemsSource = mainLibrary.FindItemByName(txtName.Text); } //If we are in the Miltiply Serarch Mode else { //Make Multiply Search by numerous parameters //including search by Item Name MultipleSearch(); } }