Пример #1
0
        public static SongInfoManager GetDefaultManager()
        {
            SongInfoManager?manager = new SongInfoManager();

            manager.AddProvider <BeatSaverSongInfoProvider>();
            manager.AddProvider <MockInfoProvider>("MockInfoProvider", 50);
            return(manager);
        }
        public async Task AndruzzProviderTest()
        {
            string filePath = Path.Combine("Data", "SongInfoProvider", "songDetails2_20210817");
            var    manager  = new SongInfoManager();

            SongFeedReaders.Logging.LoggingController.DefaultLogger = new SongFeedReaders.Logging.FeedReaderLogger();
            var andruzz = new AndruzzScrapedInfoProvider(filePath)
            {
                CacheToDisk   = false,
                AllowWebFetch = false
            };

            manager.AddProvider(andruzz);
            Assert.IsFalse(andruzz.Available);
            var response = await manager.GetSongByKeyAsync("b");

            Assert.IsTrue(andruzz.Available);
            Assert.IsTrue(response.Success);
            ScrapedSong song = response.Song ?? throw new AssertFailedException("Song is null");

            Assert.AreEqual("B", song.Key);
            Assert.AreEqual("19F2879D11A91B51A5C090D63471C3E8D9B7AEE3", song.Hash);
            Assert.AreEqual("rustic", song.LevelAuthorName);
            Assert.AreEqual("Believer", song.Name);
        }
        public async Task BeatSaverProviderTest()
        {
            var manager = new SongInfoManager();

            SongFeedReaders.Logging.LoggingController.DefaultLogger = new SongFeedReaders.Logging.FeedReaderLogger();
            var beatSaver = new BeatSaverSongInfoProvider();

            manager.AddProvider(beatSaver);
            var response = await manager.GetSongByKeyAsync("b");

            Assert.IsTrue(response.Success);
            ScrapedSong song = response.Song ?? throw new AssertFailedException("Song is null");

            Assert.AreEqual("B", song.Key);
            Assert.AreEqual("19F2879D11A91B51A5C090D63471C3E8D9B7AEE3", song.Hash);
            Assert.AreEqual("rustic", song.LevelAuthorName);
            Assert.AreEqual("Believer", song.Name);
        }