private static RoomPhotosByAccommodationIdQuery Query()
        {
            var providerMock = new Mock <IQueryDispatcher>();

            //Act
            var query = new RoomPhotosByAccommodationIdQuery(providerMock.Object);

            return(query);
        }
        public void Instance_Implement_Interface_IHaveAccommodationId()
        {
            //Arrange
            var providerMock = new Mock <IQueryDispatcher>();

            //Act
            var query = new RoomPhotosByAccommodationIdQuery(providerMock.Object);

            //Assert
            Assert.IsInstanceOf <IHaveAccommodationId>(query);
        }
        protected IQueryable <RoomPhoto> ProjectionToRoomPhotos(IQueryable <Photo> photosOfAccommodations, RoomPhotosByAccommodationIdQuery query)
        {
            var photosOfRooms = photosOfAccommodations.SelectMany(p => p.ToTypesOfRooms).Select(p => p.Id);

            photosOfAccommodations = photosOfAccommodations
                                     .Where(p => p.RealEstateId == query.AccommodationId)
                                     .Where(p => photosOfRooms.Contains(p.Id));

            return(ProjectTo <RoomPhoto>(photosOfAccommodations));
        }
 public override async Task <IEnumerable <RoomPhoto> > HandleAsync(RoomPhotosByAccommodationIdQuery query, CancellationToken cancellationToken)
 {
     return(await ProjectionToRoomPhotos(Source, query).ToArrayAsync(cancellationToken));
 }