Beispiel #1
0
        public void ConventionSpec_Returns_Filtered()
        {
            //Arrange
            using (var uow = CreateMemoryUoW(typeof(Author)))
            {
                uow.Add(new Author(1, "A.A.Author"));
                uow.Add(new Author(2, "A.B.Author"));
                uow.Add(new Author(3, "C.D.Author"));
                uow.Add(new Author(4, "C.D.Author"));
                uow.Add(new Author(5, "E.E.Author"));

                var qrit = new AuthorQrit {
                    Name = "C"
                };
                var spec = LinqSpec <Author> .ByConvention(qrit);

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

                //Assert
                Assert.IsTrue(actual.All(a => a.Name.StartsWith(qrit.Name)));
            }
        }