Esempio n. 1
0
        public void SpecLinquery_Default_ReturnsAll()
        {
            //Arrange
            const int numOfAuthors = 20;

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

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

                var handler = new LinqRequestHandler(linqProviderFactoryStub.Object);

                IQuery <IQriteria, IEnumerable <AuthorDto> > query = new SpecLinqQuery <IQriteria, Author, IEnumerable <AuthorDto> >(
                    LinqSpec <Author> .All(),
                    handler,
                    serviceLocator.GetInstance <IEnumLinqConvertor <AuthorDto> >()
                    );

                //Act
                var actual = query.Ask(new NameQriteria());

                //Assert
                Assert.AreEqual(numOfAuthors, actual.Count());
            }
        }
Esempio n. 2
0
        public void EmptyLinqSpec_ReturnsAll()
        {
            //Arrange
            const int numOfAuthors = 5;

            using (var uow = CreateMemoryUoW(typeof(Author)))
            {
                AddAuthors(uow, numOfAuthors);
                var spec = LinqSpec <Author> .All();

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

                //Assert
                Assert.AreEqual(numOfAuthors, actual.Count());
            }
        }
Esempio n. 3
0
 public AllEntityLinquery(ILinqRequestHandler handler, IEnumLinqConvertor <TResponse> convertor)
     : base(LinqSpec <TEntity> .All(), handler, convertor)
 {
 }