private Release GetReleaseFromSearch(ReleaseSearch releaseSearch, string artistName) { return(releaseSearch.Results != null ? releaseSearch.Results.FirstOrDefault(x => x.Release.Artist.Name == artistName).Release ?? releaseSearch.Results.FirstOrDefault().Release : null); }
public ReleaseDetailController() { IKernel kernal = new StandardKernel(new BindModule()); var amazonItemRepo = kernal.Get <IAmazonItemRepository>(); var itunesItemRepo = kernal.Get <IItunesItemRepository>(); _releaseSearch = new ReleaseSearch(amazonItemRepo, itunesItemRepo); }
public void Can_hit_endpoint_with_paging() { ReleaseSearch artistBrowse = Api <ReleaseSearch> .Create .WithParameter("q", "no surprises") .WithParameter("page", "2") .WithParameter("pageSize", "20") .Please(); Assert.That(artistBrowse, Is.Not.Null); Assert.That(artistBrowse.Page, Is.EqualTo(2)); Assert.That(artistBrowse.PageSize, Is.EqualTo(20)); }
public void Can_hit_endpoint() { ReleaseSearch release = Api <ReleaseSearch> .Create .WithParameter("q", "no surprises") .WithParameter("type", ReleaseType.Single.ToString()) .WithParameter("country", "GB") .Please(); Assert.That(release, Is.Not.Null); Assert.That(release.Results.Count, Is.GreaterThan(0)); Assert.That(release.Results.FirstOrDefault().Release.Type, Is.EqualTo(ReleaseType.Single)); }
public Release GetRelease(string artistName, string releaseTitle) { ReleaseSearch releaseSearch = GetReleaseTitleMatches(releaseTitle); if (releaseSearch != null) { var releaseFromSearch = GetReleaseFromSearch(releaseSearch, artistName); if (releaseFromSearch != null) { releaseFromSearch.Image = GenerateLargePackshotImage(releaseFromSearch.Image); } return(releaseFromSearch); } return(null); }
public IActionResult Get(string asin) { var releaseSearch = new ReleaseSearch(_amazonItemRepo, _itunesItemRepo); MusicReleaseCollection musicReleaseDetailModel = null; try { musicReleaseDetailModel = releaseSearch.GetDetails(asin); } catch (WebException ex) { return(StatusCode(500, ex.Message)); } if (musicReleaseDetailModel != null) { return(Ok(musicReleaseDetailModel)); } else { return(StatusCode(500)); } }