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(); }
public List <PhotoViewModel> FromBltoUiGetAll() { var getData = _photoRepository.GetAll().ToList(); var randomPhoto = Mapper.Map <List <Photo>, List <PhotoViewModel> >(getData); return(randomPhoto); }
public void OnLoad() { Photos.Clear(); var photos = photoRepository.GetAll(); foreach (var photo in photos) { Photos.Add(photo); } }
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); }
/// <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>(); }
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, })); }
public List <Photo> GetAll(ResponseProperties properties) { return(photoRepository.GetAll(properties)); }
public void PhotoGetAll_NotNull() { Assert.NotNull(photoRepositorySUT.GetAll()); }