public void GetAll_NoClientResults_ReturnsEmptyList()
        {
            IReadOnlyCollection <PhotoDto> clientResponsePhotos = new List <PhotoDto>();

            _mockClient.GetPhotos().Returns(Task.FromResult(clientResponsePhotos));

            var result = _repository.GetAll();

            Assert.AreEqual(0, result.Count);
            _mockClient.Received(1).GetPhotos();
        }
예제 #2
0
        public List <PhotoViewModel> FromBltoUiGetAll()
        {
            var getData     = _photoRepository.GetAll().ToList();
            var randomPhoto = Mapper.Map <List <Photo>, List <PhotoViewModel> >(getData);

            return(randomPhoto);
        }
예제 #3
0
        public void OnLoad()
        {
            Photos.Clear();

            var photos = photoRepository.GetAll();

            foreach (var photo in photos)
            {
                Photos.Add(photo);
            }
        }
예제 #4
0
        public static List <PhotoData> GetPhotos()
        {
            PhotoRepository  rep       = new PhotoRepository();
            List <Photo>     photos    = rep.GetAll().ToList();
            List <PhotoData> newPhotos = new List <PhotoData>();

            photos.ForEach(x => newPhotos.Add(new PhotoData
            {
                Id    = x.Id,
                PetId = x.PetId,
                Path  = x.Path
            }));
            return(newPhotos);
        }
예제 #5
0
        /// <summary>
        /// This method will return just the id's and filenames of the pictures to use to retrieve the image from the db
        /// </summary>
        /// <returns></returns>
        private List <Photo> GetThePictures()
        {
            //var thePictureColleciton = ModelContext.Create().Photos;
            //var thePictureCursor = thePictureColleciton.Find(i => true);

            //PhotoService service = new PhotoService(new PhotoRepository());
            PhotoRepository service = new PhotoRepository();

            return(service.GetAll().Select(u => u.ToOrmPhoto()).ToList());

            //use SetFields to just return the id and the name of the picture instead of the entire document
            //thePictureCursor.SetFields(Fields.Include("_id", "FileName"));

            //return thePictureCursor.ToList() ?? new List<Photo>();
        }
예제 #6
0
        public IEnumerable <PhotoViewModel> GetAllPhotos(string filter = null, int page = 1, int pageSize = 20)
        {
            PhotoRepository photoRepository = new PhotoRepository();

            return(photoRepository.GetAll()
                   .Where(x => filter == null || (x.Description.Contains(filter)))
                   .OrderByDescending(x => x.PhotoId)
                   .Skip((page - 1) * pageSize)
                   .Take(pageSize)
                   .ToList().Select(photo =>
                                    new PhotoViewModel()
            {
                PhotoId = photo.PhotoId,
                Description = photo.Description,
                ThumbPath = photo.ThumbPath,
                ImagePath = photo.ImagePath,
            }));
        }
예제 #7
0
 public List <Photo> GetAll(ResponseProperties properties)
 {
     return(photoRepository.GetAll(properties));
 }
예제 #8
0
 public void PhotoGetAll_NotNull()
 {
     Assert.NotNull(photoRepositorySUT.GetAll());
 }