예제 #1
0
        public void GetSongsFromFeed_Bookmarks()
        {
            var reader   = new BeastSaberReader("Zingabopp", DefaultMaxConcurrency);
            int maxSongs = 60;
            var settings = new BeastSaberFeedSettings((int)BeastSaberFeed.Bookmarks)
            {
                MaxSongs = maxSongs
            };
            var songList = reader.GetSongsFromFeed(settings);

            Assert.IsTrue(songList.Count > 0);
            Assert.IsFalse(songList.Count > maxSongs);
            Assert.IsFalse(songList.Any(s => string.IsNullOrEmpty(s.Key)));
        }
        public void CancelledInProgress()
        {
            var         cts      = new CancellationTokenSource(500);
            IFeedReader reader   = new BeastSaberReader("Zingabopp", 1);
            int         maxSongs = 300;
            var         settings = new BeastSaberFeedSettings((int)BeastSaberFeedName.CuratorRecommended)
            {
                MaxSongs = maxSongs
            };
            var result = reader.GetSongsFromFeed(settings, cts.Token);

            Assert.IsFalse(result.Successful);
            Assert.AreEqual(FeedResultError.Cancelled, result.ErrorCode);
            cts.Dispose();
        }
예제 #3
0
        public void GetSongsFromFeed_CuratorRecommended_LimitedPages()
        {
            var reader   = new BeastSaberReader("Zingabopp", DefaultMaxConcurrency);
            int maxSongs = 30;
            int maxPages = 2;
            var settings = new BeastSaberFeedSettings((int)BeastSaberFeed.CuratorRecommended)
            {
                MaxPages = maxPages, MaxSongs = maxSongs
            };
            var songList = reader.GetSongsFromFeed(settings);

            Assert.IsTrue(songList.Count == maxSongs);
            Assert.IsFalse(songList.Any(s => string.IsNullOrEmpty(s.Key)));
            Assert.IsFalse(songList.Any(s => s.Value.DownloadUri == null));
        }
예제 #4
0
        public void GetSongsFromFeed_Followings_SinglePage()
        {
            var reader   = new BeastSaberReader("Zingabopp", DefaultMaxConcurrency);
            int maxSongs = 150;
            int maxPages = 1;
            var settings = new BeastSaberFeedSettings((int)BeastSaberFeed.Following)
            {
                MaxSongs = maxSongs,
                MaxPages = maxPages
            };
            var songList = reader.GetSongsFromFeed(settings);

            Assert.IsTrue(songList.Count > 0);
            Assert.IsTrue(songList.Count <= 100);
            //Assert.IsFalse(songList.Count > maxSongs);
            Assert.IsFalse(songList.Any(s => string.IsNullOrEmpty(s.Key)));
        }
예제 #5
0
        public void GetSongsFromFeed_Followings_SinglePage_LimitedSongs()
        {
            var reader = new BeastSaberReader("Zingabopp", DefaultMaxConcurrency)
            {
                StoreRawData = true
            };
            int maxSongs = 20;
            int maxPages = 1;
            var settings = new BeastSaberFeedSettings((int)BeastSaberFeed.Following)
            {
                MaxSongs = maxSongs,
                MaxPages = maxPages
            };
            var songList     = reader.GetSongsFromFeed(settings);
            var pagesChecked = songList.Values.GroupBy(s => s.SourceUri);

            Assert.IsTrue(pagesChecked.Count() == 1);
            Assert.IsTrue(songList.Count > 0);
            Assert.IsTrue(songList.Count <= 20);
            //Assert.IsFalse(songList.Count > maxSongs);
            Assert.IsFalse(songList.Any(s => string.IsNullOrEmpty(s.Key)));
        }