public void TestAlwaysAdd() { var alwaysAdd = new List<Song>(GetRandomSongs(250)); var all = new List<Song>(GetRandomSongs(7500)); all.AddRange(alwaysAdd); var songs = new PlaylistGenerator(new List<ICriteriaCounter<Song>>()).GeneratePlayList(all, alwaysAdd.Count, alwaysAdd); CollectionAssert.AreEquivalent(songs.ToArray(), alwaysAdd); }
public void TestCriteriaFilter() { var firstCat = "one"; var firstCriteria = new List<Song>(GetRandomSongs(10)); firstCriteria.ForEach(x => x.Category = firstCat); var all = new List<Song>(GetRandomSongs(75000)); all.AddRange(firstCriteria); var criteria = new List<ICriteriaCounter<Song>>() { new CriteriaCounter(song => song.Category == firstCat, firstCriteria.Count() + 100) }; var songs = new PlaylistGenerator(criteria).GeneratePlayList(all, firstCriteria.Count, new List<Song>()); CollectionAssert.AreEquivalent(songs.ToArray(), firstCriteria); }