Example #1
0
        public void Search_NullQuery()
        {
            var settings = new ScoreSaberFeedSettings(ScoreSaberFeedName.Search);
            var feed     = new ScoreSaberFeed(settings);
            var ex       = Assert.ThrowsException <InvalidFeedSettingsException>(() => feed.EnsureValidSettings());

            Console.WriteLine(ex.Message);
            Assert.IsFalse(feed.HasValidSettings);
        }
Example #2
0
        public void Search_HasQuery()
        {
            var settings = new ScoreSaberFeedSettings(ScoreSaberFeedName.Search);

            settings.SearchQuery = "test";
            var feed = new ScoreSaberFeed(settings);

            feed.EnsureValidSettings();
            Assert.IsTrue(feed.HasValidSettings);
        }
Example #3
0
        public void QuerylessFeeds()
        {
            var querylessFeeds = new ScoreSaberFeedName[] { ScoreSaberFeedName.LatestRanked, ScoreSaberFeedName.TopPlayed, ScoreSaberFeedName.TopRanked, ScoreSaberFeedName.Trending };

            foreach (var feedType in querylessFeeds)
            {
                var settings = new ScoreSaberFeedSettings(feedType);
                var feed     = new ScoreSaberFeed(settings);
                feed.EnsureValidSettings();
                Assert.IsTrue(feed.HasValidSettings);
            }
        }
Example #4
0
        public void GetSongsFromPageText_Url()
        {
            var reader = new ScoreSaberReader()
            {
                StoreRawData = true
            };
            var    pageText = File.ReadAllText("Data\\ScoreSaberPage.json");
            string url      = Path.GetFullPath("Data\\ScoreSaberPage.json");
            var    songList = ScoreSaberFeed.GetSongsFromPageText(pageText, new Uri(url), true);

            Assert.IsTrue(songList.Count == 50);
            var firstHash = "0597F8F7D8E396EBFEF511DC9EC98B69635CE532";

            Assert.IsTrue(songList.First().Hash == firstHash);
            var firstRawData = JToken.Parse(songList.First().RawData);

            Assert.IsTrue(firstRawData["uid"]?.Value <int>() == 143199);
            var lastHash = "F369747C6B54914DEAA163AAE85816BA5A8C1845";

            Assert.IsTrue(songList.Last().Hash == lastHash);
        }