public JsonResult SearchTrack(string q)
        {
            var youtubeProvider = new YouTubeTrackProvider();
            var searchResult    = youtubeProvider.Search(q, maxResults: 3);

            return(Json(searchResult, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public void TestYoutubeSearchNoResult()
        {
            ITrackProvider youtubeProvider = new YouTubeTrackProvider();
            List <Track>   tracks          = youtubeProvider.Search("dfgjisdkfmsdkmldksmflksdmlfkmsdflksmdlfksmdlfksdmlfksdfmlksdfmlksdfmlksdfmlksdf");

            Assert.AreEqual(0, tracks.Count);
        }
        public IHttpActionResult searchTrack(string query)
        {
            if (query == null)
            {
                return(NotFound());
            }
            var youtubeProvider = new YouTubeTrackProvider();
            var searchResult    = youtubeProvider.Search(query);

            return(Ok(searchResult));
        }
        public void TestYoutubeSearch()
        {
            ITrackProvider youtubeProvider = new YouTubeTrackProvider();
            List<Track> tracks = youtubeProvider.Search("Rick Astley - Never Gonna Give You Up");

            var firstResult = tracks.FirstOrDefault(t => t.Title.ToLower().Contains("never gonna give you up"));
            Assert.IsNotNull(firstResult);
            Assert.AreEqual(firstResult.Artist.ToLower(), "rick astley");
            Assert.AreEqual(firstResult.TrackSource.SourceType, SourceType.YouTube);
            Assert.IsNotNull(firstResult.TrackSource.Url);
            Assert.IsNotNull(firstResult.CoverArtUrl);
        }
Example #5
0
        public void TestYoutubeSearch()
        {
            ITrackProvider youtubeProvider = new YouTubeTrackProvider();
            List <Track>   tracks          = youtubeProvider.Search("Rick Astley - Never Gonna Give You Up");

            var firstResult = tracks.FirstOrDefault(t => t.Title.ToLower().Contains("never gonna give you up"));

            Assert.IsNotNull(firstResult);
            Assert.AreEqual(firstResult.Artist.ToLower(), "rick astley");
            Assert.AreEqual(firstResult.TrackSource.SourceType, SourceType.YouTube);
            Assert.IsNotNull(firstResult.TrackSource.Url);
            Assert.IsNotNull(firstResult.CoverArtUrl);
        }
 public void TestYoutubeSearchNoResult()
 {
     ITrackProvider youtubeProvider = new YouTubeTrackProvider();
     List<Track> tracks = youtubeProvider.Search("dfgjisdkfmsdkmldksmflksdmlfkmsdflksmdlfksmdlfksdmlfksdfmlksdfmlksdfmlksdfmlksdf");
     Assert.AreEqual(0, tracks.Count);
 }