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);
        }
예제 #2
0
        public static SongInfoManager GetDefaultManager()
        {
            SongInfoManager?manager = new SongInfoManager();

            manager.AddProvider <BeatSaverSongInfoProvider>();
            manager.AddProvider <MockInfoProvider>("MockInfoProvider", 50);
            return(manager);
        }
예제 #3
0
        public async Task GetNonexistantHash()
        {
            SongInfoManager  manager  = GetDefaultManager();
            string           hash     = "9d11a002f1d2b6b08dce90a32dab62b8ed";
            SongInfoResponse response = await manager.GetSongByHashAsync(hash).ConfigureAwait(false);

            Assert.IsFalse(response.Success);
            Assert.IsNull(response.Song);
            Assert.AreEqual(2, response.GetFailedResponses().Length);
        }
예제 #4
0
        public async Task GetNonexistantKey()
        {
            SongInfoManager  manager  = GetDefaultManager();
            string           key      = "9d11a8ed";
            SongInfoResponse response = await manager.GetSongByKeyAsync(key).ConfigureAwait(false);

            Assert.IsFalse(response.Success);
            Assert.IsNull(response.Song);
            Assert.AreEqual(2, response.GetFailedResponses().Length);
        }
예제 #5
0
        public async Task GetByHashNotInMock()
        {
            SongInfoManager  manager  = GetDefaultManager();
            string           hash     = "9d11a002f1d2b6b08dce90a3e2b4a62dab62b8ed";
            SongInfoResponse response = await manager.GetSongByHashAsync(hash).ConfigureAwait(false);

            Assert.IsTrue(response.Success);
            Assert.IsTrue(response.Source is BeatSaverSongInfoProvider);
            Assert.IsNotNull(response.Song);
            Assert.AreEqual(1, response.GetFailedResponses().Length);
        }
예제 #6
0
        public async Task GetByHashFromMock()
        {
            SongInfoManager  manager  = GetDefaultManager();
            string           hash     = "e2512e6fbf85059d9fd9b429f62b2e618dd4d7e9";
            SongInfoResponse response = await manager.GetSongByHashAsync(hash).ConfigureAwait(false);

            Assert.IsTrue(response.Success);
            Assert.IsTrue(response.Source is MockInfoProvider);
            Assert.IsNotNull(response.Song);
            Assert.AreEqual(0, response.GetFailedResponses().Length);
        }
예제 #7
0
        public async Task GetByKeyNotInMock()
        {
            SongInfoManager  manager  = GetDefaultManager();
            string           key      = "b";
            SongInfoResponse response = await manager.GetSongByKeyAsync(key).ConfigureAwait(false);

            Assert.IsTrue(response.Success);
            Assert.IsTrue(response.Source is BeatSaverSongInfoProvider);
            Assert.IsNotNull(response.Song);
            Assert.AreEqual(1, response.GetFailedResponses().Length);
        }
        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);
        }