public void WhenIMapAlbum_WithValidObject_IGetDto() { Photo photo = GetPhoto(); PhotoDto dto = _mapper.ToPhotoDto(photo); Assert.AreEqual(photo.Title, dto.Title); Assert.AreEqual(photo.Id, dto.Id); Assert.AreEqual(photo.ThumbnailUrl, dto.ThumbnailUrl); Assert.AreEqual(photo.Url, dto.Url); }
public async Task <List <PhotoDto> > GetAlbumPhotos(int albumId) { if (!_validator.IsValid(albumId)) { throw new DataValidationException("AlbumId"); } ICollection <Photo> photos = await _photoApi.GetApiCollection($"{photoEndpoint}?albumId=" + albumId); return(photos.Select(photo => _mapper.ToPhotoDto(photo)).ToList()); }