private static AccommodationSuggestionsQuery Query()
        {
            var dispatcherMock = new Mock <IQueryDispatcher>();
            var query          = new AccommodationSuggestionsQuery(dispatcherMock.Object);

            return(query);
        }
        public override async Task <IEnumerable <Suggestion> > HandleAsync(AccommodationSuggestionsQuery query, CancellationToken cancellationToken)
        {
            var q = Source.Where(p => p.LanguageId == query.LanguageId);

            q = query.Terms.Aggregate(q, (current, term) => current.Where(p => p.Name.Contains(term)));

            return(await ProjectTo <Suggestion>(q.Take(3)).ToArrayAsync(cancellationToken));
        }
        public void HandleAsync_Returns_Task_Of_IEnumerable_Of_Suggestion()
        {
            //Arrange
            var type       = typeof(Task <IEnumerable <Suggestion> >);
            var handler    = Handler();
            var dispatcher = new Mock <IQueryDispatcher>();
            var query      = new AccommodationSuggestionsQuery(dispatcher.Object);

            //Act
            var result = handler.HandleAsync(query);

            //Assert

            Assert.IsInstanceOf(type, result);
        }