private async Task <List <AlbumViewModel> > SetupAlbumsService(int userId, string fileLocation)
        {
            // Arrange
            List <AlbumViewModel> albumViewModels     = MockedData.GetAlbumViewModels(fileLocation);
            HttpResponseMessage   httpResponseMessage = new HttpResponseMessage()
            {
                Content = new JsonContent(albumViewModels)
            };

            _mockHttpRequestFactory.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(httpResponseMessage));
            var unitUnderTest = CreateService();

            return(await unitUnderTest.GetUserAlbums(userId));
        }
Exemple #2
0
        private async Task <List <PhotoViewModel> > SetupPhotoViewModels(int userId, string albumsFileLocation, string photosFileLocation)
        {
            // Arrange
            List <AlbumViewModel> albumViewModels = MockedData.GetAlbumViewModels(albumsFileLocation);

            _mockAlbumService.Setup(x => x.GetUserAlbums(userId)).Returns(Task.FromResult(albumViewModels.Where(a => a.UserId == userId).ToList()));
            List <PhotoViewModel> photoViewModels     = MockedData.GetPhotoViewModels(photosFileLocation);
            HttpResponseMessage   httpResponseMessage = new HttpResponseMessage()
            {
                Content = new JsonContent(photoViewModels)
            };

            _mockHttpRequestFactory.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(httpResponseMessage));
            var unitUnderTest = CreateService();

            return(await unitUnderTest.GetUserSpecificAlbumPhotos(userId));
        }