private static CategoriesListItemsQuery CategoriesListItemsQuery()
        {
            var queryDispatcherMock = new Mock <IQueryDispatcher>();

            var query = new CategoriesListItemsQuery(queryDispatcherMock.Object);

            return(query);
        }
예제 #2
0
        public override async Task <IEnumerable <CategoryListItemDto> > HandleAsync(CategoriesListItemsQuery query, CancellationToken token)
        {
            var categories = await Session.QueryOver <Category>().OrderBy(p => p.Name).Asc.ListAsync(token);

            var result = MapTo <IEnumerable <CategoryListItemDto> >(categories);

            return(result);
        }
        public void HandleAsync_Returns_Task_Of_IEnumerable_Of_CategoryListItemDto()
        {
            //Arrange
            var handler = CategoriesListItemsQueryHandler();

            var dispatcherMock = new Mock <IQueryDispatcher>();
            var query          = new CategoriesListItemsQuery(dispatcherMock.Object);

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

            //Assert
            Assert.IsInstanceOf <Task <IEnumerable <CategoryListItemDto> > >(result);
        }
 public override async Task <IEnumerable <CategoryListItemDto> > HandleAsync(CategoriesListItemsQuery query,
                                                                             CancellationToken token)
 {
     return(await ProjectTo <CategoryListItemDto>(Entities().OrderBy(x => x.Name)).ToArrayAsync(token));
 }