コード例 #1
0
 public QueryController(IFilterQuery query, IAppUser user, ICourseQuery courseQuery, IMapper mapper, IUnitOfWork <CPDbContext> unitOfWork, IPermission pm) : base(user, mapper)
 {
     _query       = query;
     _courseQuery = courseQuery;
     _unitOfWrok  = unitOfWork;
     _pm          = pm;
 }
コード例 #2
0
        private void AddFilterToFilterRules(IFilterQuery query)
        {
            ULSQuery ulsQuery = (ULSQuery)query;

            CheckExistingFilter(ulsQuery.FilterName);

            _filterRules.Add(ulsQuery.FilterName, new TemplateFilter(query));
        }
コード例 #3
0
        public void GetStream_AnonymousData_ExceptionPropagated(
            [Frozen] Mock<IListener> listner,
            IFilterQuery query,
            Streaming sut)
        {
            //Arrange
            listner.Setup(a => a.Listen(It.IsAny<Func<HttpRequestMessage>>(), It.IsAny<Action<string>>()))
                .Throws<WebException>();
            Exception propagatedException = null;

            //Act
            var observable = sut.GetStream(query);
            observable.Subscribe(a => { }, ex => propagatedException = ex);

            //Assert
            propagatedException.Should().NotBeNull();
            propagatedException.Should().BeOfType<WebException>();
        }
コード例 #4
0
        public void GetStream_AnonymousData_CorrectObservable(
            [Frozen] Mock<IListener> listner,
            IFilterQuery query,
            Streaming sut,
            HttpRequestMessage request,
            List<string> data)
        {
            listner.Setup(a => a.Listen(It.IsAny<Func<HttpRequestMessage>>(), It.IsAny<Action<string>>()))
                .Returns((Func<HttpRequestMessage> requestProvider, Action<string> processRequest) =>
                {
                    data.ForEach(processRequest);
                    return new Task(() => { });
                });

            var observable = sut.GetStream(query);

            var resultData = new List<string>();
            observable.Subscribe(a => resultData.Add(a));
            resultData.ShouldAllBeEquivalentTo(data);
        }
コード例 #5
0
 public FilterStreamQueryBuilder(IFilterQuery filterQuery)
 {
     if (filterQuery == null) throw new ArgumentNullException("filterQuery");
     _filterQuery = filterQuery;
 }
コード例 #6
0
 /// <summary>
 /// Create new instance of <see cref="FilterAndPageQuery"/>
 /// </summary>
 /// <param name="filterQuery">Filter query.</param>
 /// <param name="pageQuery">Page query.</param>
 public FilterAndPageQuery(IFilterQuery filterQuery, IPageQuery pageQuery)
     : base(new IQuery[] { filterQuery, pageQuery })
 {
 }
コード例 #7
0
 public TemplateFilter(IFilterQuery query)
 {
     SetQueryObject(query);
 }
コード例 #8
0
 public FilterRepository(IFilterCommand filterCommand, IFilterQuery filterQuery)
 {
     _filterCommand = filterCommand;
     _filterQuery   = filterQuery;
 }
コード例 #9
0
 public void SetQueryObject(IFilterQuery query)
 {
     Query = query;
 }
コード例 #10
0
        public static IQueryable <T> Where <T>(this IQueryable <T> query, IFilterQuery <T> args)
        {
            query = (args.Predicate != null) ? query.Where(args.Predicate) : query;

            return(query);
        }