示例#1
0
        public void ExpressionSpec_WithExpression()
        {
            //Arrange
            const int numOfAuthors = 20, id = 10;

            using (var uow = CreateMemoryUoW(typeof(Author)))
            {
                AddAuthors(uow, numOfAuthors);

                //var linqProviderFactoryStub = new Mock<ILinqProviderFactory>();
                //linqProviderFactoryStub.Setup(a => a.Create(It.IsAny<String>(), It.IsAny<String>())).Returns(uow.Linq);
                //ILinqQueryHandler handler = new LinqQueryHandler(linqProviderFactoryStub.Object);

                var spec = LinqSpec <Author> .Filter <IQriteria>((a) => a.Id > id);

                //Act
                var actual = spec.Query(uow.Linq.Query <Author>(), new NameQriteria());

                //Assert
                Assert.IsFalse(actual.Any(a => a.Id <= id));
            }
        }
示例#2
0
 public FilteredAuthorLinquery(ILinqRequestHandler handler, IEnumLinqConvertor <Author> convertor)
     : base(LinqSpec <Author> .Filter <EmptyQriteria>((a) => a.Id > 1), handler, convertor)
 {
 }