コード例 #1
0
        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);
        }
コード例 #2
0
        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());
        }