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); }
public void FilterPlaylistLibraryChange() { var lib = new Library(); var fpl = new FilterPlaylist(lib, "fpl 4"); fpl.Filters.Add(new StringFilter("genre", "noise", true)); fpl.FilterLibrary(); Assert.AreEqual(0, fpl.NumSongs); AddSongsToLibrary(lib); lib.Changed += (s, e) => { }; fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); }
public void FilterPlaylistApplyTitleFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); fpl.Filters.Add(new StringFilter("title", "2", true)); fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); fpl.Filters.Add(new StringFilter("title", "2", false)); fpl.FilterLibrary(); Assert.AreEqual(0, fpl.NumSongs); }
public void FilterPlaylistApplyCombinationFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); fpl.Filters.Add(new StringFilter("genre", "noise", true)); fpl.Filters.Add(new RatingFilter(3, false, true)); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); }
public void FilterPlaylistApplyRatingFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); var filter = new RatingFilter(3, true, false); fpl.Filters.Add(filter); fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); filter.SetParams(3, true, true); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.SetParams(3, false, true); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.SetParams(3, false, false); fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); }
public void FilterPlaylistSave() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); fpl.Filters.Add(new StringFilter("genre", "NoIsE", true)); fpl.Filters.Add(new DateFilter(TimeUnit.Day, 10)); fpl.Filters.Add(new RatingFilter(4, true, true)); fpl.FilterLibrary(); try { fpl.Save(); } catch { Assert.Fail(); } }
public void FilterPlaylistApplyDateFilter() { var lib = CreateLibrary(); var fpl = new FilterPlaylist(lib, "fpl 1"); var filter = new DateFilter(TimeUnit.Day, 2); fpl.Filters.Add(filter); fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); filter.SetLimit(TimeUnit.Day, 7); fpl.FilterLibrary(); Assert.AreEqual(1, fpl.NumSongs); filter.SetLimit(TimeUnit.Day, 13); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.SetLimit(TimeUnit.Week, 2); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.SetLimit(TimeUnit.Month, 2); fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); filter.SetLimit(TimeUnit.Month, 4); fpl.FilterLibrary(); Assert.AreEqual(3, fpl.NumSongs); filter.SetLimit(TimeUnit.Month, 34); fpl.FilterLibrary(); Assert.AreEqual(3, fpl.NumSongs); }