Пример #1
0
        public async Task Should_Return_Merged_Albums_And_Photos_When_Calling_GetAlbumsWithPhotos()
        {
            var albumsApiService = new Mock <IAlbumsApiClient>();

            albumsApiService.Setup(x => x.GetAlbums()).ReturnsAsync(new List <AlbumConsume>()
            {
                new AlbumConsume {
                    Id = 1, Title = "Test", UserId = 1
                }
            });
            albumsApiService.Setup(x => x.GetPhotos()).ReturnsAsync(new List <PhotoConsume>()
            {
                new PhotoConsume()
                {
                    Id = 1, AlbumId = 1, Title = "Test Photo", ThumbnailUrl = "something", Url = "something"
                }
            });

            var albumsService = new AlbumsService(albumsApiService.Object, _mapper);

            var albums = await albumsService.GetAlbumsWithPhotos();

            Assert.Single(albums);
            Assert.Collection(albums, album => Assert.Single(album.Photos));
        }