public void Success_Plays() { var reader = new BeatSaverReader() { StoreRawData = true }; int maxSongs = 50; var settings = new BeatSaverFeedSettings((int)BeatSaverFeed.Plays) { MaxSongs = maxSongs }; var result = reader.GetSongsFromFeed(settings); Assert.IsTrue(result.Count == settings.MaxSongs); int expectedPages = ExpectedPagesForSongs(result.Count); Assert.IsTrue(expectedPages <= result.PagesChecked); foreach (var song in result.Songs.Values) { Console.WriteLine($"{song.SongName} by {song.MapperName}, {song.Hash}"); } }
public void Search_Default_LimitedSongs() { var reader = new BeatSaverReader() { StoreRawData = true }; int maxSongs = 10; var settings = new BeatSaverFeedSettings((int)BeatSaverFeed.Search) { MaxSongs = maxSongs, Criteria = "Believer" }; var result = reader.GetSongsFromFeed(settings); Assert.IsTrue(result.Count > 0); Assert.IsTrue(result.Count <= 10); int expectedPages = ExpectedPagesForSongs(result.Count); Assert.AreEqual(expectedPages, result.PagesChecked); foreach (var song in result.Songs.Values) { Console.WriteLine($"{song.SongName} by {song.MapperName}, {song.Hash}"); } }
public void GetSongsFromFeed_Authors_Test() { var reader = new BeatSaverReader() { StoreRawData = true }; var authorList = new string[] { "BlackBlazon", "greatyazer" }; var settings = new BeatSaverFeedSettings((int)BeatSaverFeed.Author) { Authors = authorList, MaxSongs = 59 }; var songsByAuthor = reader.GetSongsFromFeed(settings); var detectedAuthors = songsByAuthor.Values.Select(s => s.MapperName.ToLower()).Distinct(); foreach (var song in songsByAuthor) { Assert.IsTrue(song.Value.DownloadUri != null); Assert.IsTrue(authorList.Any(a => a.ToLower() == song.Value.MapperName.ToLower())); } foreach (var author in authorList) { Assert.IsTrue(songsByAuthor.Any(s => s.Value.MapperName.ToLower() == author.ToLower())); } // BlackBlazon check var blazonHash = "58de2d709a45b68fdb1dbbfefb187f59f629bfc5".ToUpper(); var blazonSong = songsByAuthor[blazonHash]; Assert.IsTrue(blazonSong != null); Assert.IsTrue(blazonSong.DownloadUri != null); // GreatYazer check var songHash = "bf8c016dc6b9832ece3030f05277bbbe67db790d".ToUpper(); var yazerSong = songsByAuthor[songHash]; Assert.IsTrue(yazerSong != null); Assert.IsTrue(yazerSong.DownloadUri != null); }
public void Search_User() { var reader = new BeatSaverReader() { StoreRawData = true }; int maxSongs = 10; string criteria = "19F2879D11A91B51A5C090D63471C3E8D9B7AEE3"; var searchType = BeatSaverSearchType.hash; var settings = new BeatSaverFeedSettings((int)BeatSaverFeed.Search) { MaxSongs = maxSongs, Criteria = criteria, SearchType = searchType }; var result = reader.GetSongsFromFeed(settings); Assert.AreEqual(1, result.Count); int expectedPages = ExpectedPagesForSongs(result.Count); Assert.AreEqual(expectedPages, result.PagesChecked); foreach (var song in result.Songs.Values) { Console.WriteLine($"{song.SongName} by {song.MapperName}, {song.Hash}"); } }