예제 #1
0
        public void TestExtractFromBadUrl(string badUrl)
        {
            var fetcher = new SoundcloudSongInfoFetcher();

            Assert.ThrowsExceptionAsync <InvalidSoundcloudPageTypeException>(() => fetcher.ExtractFromStringAsyncTask(badUrl))
            .GetAwaiter().GetResult();
        }
예제 #2
0
        public void TestExtractFromUrl(string url, string title, string firstArtist, string firstGenre)
        {
            var fetcher = new SoundcloudSongInfoFetcher();
            var result  = fetcher.ExtractFromStringAsyncTask(url).GetAwaiter().GetResult();

            Assert.AreEqual(title, result.Title);
            Assert.AreEqual(firstArtist, result.Artists[0]);
            Assert.AreEqual(firstGenre, result.Genres[0]);
            Assert.IsNotNull(result.Pictures);
            Assert.AreNotEqual(0, result.Pictures.Length);
        }
        public void TestExtractFromBadUrl(string badUrl)
        {
            var fetcher = new SoundcloudSongInfoFetcher();

            try
            {
                fetcher.ExtractFromStringAsyncTask(badUrl).GetAwaiter().GetResult();
            }
            catch (InvalidSoundcloudPageTypeException)             // expected
            {
                return;
            }
            catch (Exception e)
            {
                Assert.Inconclusive("This test requires an internet connection. Manually check the error.", e);
            }

            Assert.Fail("No exception has been thrown.");
        }
        public void TestExtractFromUrl(string url, string title, string firstArtist, string firstGenre)
        {
            var fetcher = new SoundcloudSongInfoFetcher();
            var result  = new SongInfo();

            try
            {
                result = fetcher.ExtractFromStringAsyncTask(url).GetAwaiter().GetResult();
            }
            catch (WebException e)
            {
                Assert.Inconclusive("An error with the connection occured. The state of this test is inconclusive.", e);
            }

            Assert.AreEqual(title, result.Title);
            Assert.AreEqual(firstArtist, result.Artists[0]);
            Assert.AreEqual(firstGenre, result.Genres[0]);
            Assert.IsNotNull(result.Pictures);
            Assert.AreNotEqual(0, result.Pictures.Length);
        }