public async Task NotFound_GetAlbumResult() { //Arrange abumDetails = new AlbumDetails(_logger, _mapper, _albumRepo); IdViewModel idViewModel = new IdViewModel(); idViewModel.AlbumId = 20; //Act ResponseViewModel data = await abumDetails.GetAlbumDetails(idViewModel); //Assert Assert.Null(data.Content); }
public async Task MatchData_GetAlbumResult() { //Arrange abumDetails = new AlbumDetails(_logger, _mapper, _albumRepo); IdViewModel idViewModel = new IdViewModel(); idViewModel.AlbumId = 3; //Act ResponseViewModel data = await abumDetails.GetAlbumDetails(idViewModel); //Assert AlbumDetailsViewModel albumDetails = (AlbumDetailsViewModel)data.Content; Assert.Equal("Classic", albumDetails.GenreName.Trim()); Assert.Equal("Backstreet_Boys", albumDetails.albumName); }
public async Task <IActionResult> GetAlbumDetails([FromBody] IdViewModel model) { try { var list = await _albumDetails.GetAlbumDetails(model); if (list == null) { return(BadRequest("SomethingWrong")); } return(Ok(list)); } catch (Exception ex) { return(BadRequest(ex.ToString())); } }