public void FilterPlaylistAddFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); var filter = new StringFilter("title", "1", true); try { fpl.Filters.Add(filter); } catch { Assert.Fail(); } Assert.AreEqual(1, fpl.Filters.Count); }
public void EditStringFilter(StringFilter filter) { old = new StringFilter(filter); SetStringFilterParams(); if (filter.Field == "title") filterType_combobox.SelectedIndex = 0; else if (filter.Field == "artist") filterType_combobox.SelectedIndex = 1; else if (filter.Field == "album") filterType_combobox.SelectedIndex = 2; else if (filter.Field == "genre") filterType_combobox.SelectedIndex = 3; if (filter.Contains) filterParams_combobox.SelectedIndex = 0; else filterParams_combobox.SelectedIndex = 1; searchString_textbox.Text = filter.SearchTerm; }
public StringFilter(StringFilter filter) : this(filter.field, filter.searchTerm, filter.Contains) { }
protected override void ReadHeader(StreamReader sr) { base.ReadHeader(sr); string filterType; while ((filterType = sr.ReadLine()) != null) { Filter filter = null; switch (filterType) { case "StringFilter": filter = new StringFilter(sr); break; case "RatingFilter": filter = new RatingFilter(sr); break; case "DateFilter": filter = new DateFilter(sr); break; default: throw new FileLoadException(); } Filters.Add(filter); } }
public void FilterPlaylistApplyGenreFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); var filter = new StringFilter("genre", "NoIsE", true); fpl.Filters.Add(filter); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.Contains = false; fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); }