public async Task <VideoItem> GetVideoItemByIdOrUrlAsync([CanBeNull] string idOrUrl) { var id = _youtubeHelpers.GetIdFromUrl(idOrUrl); var video = await _videoRepository.GetByIdentifierAsync(id).ConfigureAwait(false); if (video != null) { return(video); } video = await _youtubeSearchService.GetVideoItemByIdentifierAsync(id).ConfigureAwait(false); return(video); }
public void Should_Get_Valid_Id_From_Url(string url, string expected) { var actual = _youtubeHelpers.GetIdFromUrl(url); Assert.Equal(expected, actual); }