Exemplo n.º 1
0
        public void IdConvention_Returns_EntityWithId()
        {
            using (var uowStub = Stub.CreateMemoryUoW(typeof(Author)).AddAuthors(5))
            {
                var qrit = new IdQriteria <Int32> {
                    Id = 3
                };

                var e = new ConventionIdLinqSpec <Author>();
                //var e = ConventionFactory<AuthorDto>.IdSpec();
                var actual = e.Query(uowStub.Linq, qrit)
                             .Cast <Author>()
                             .Single();

                Assert.AreEqual(qrit.Id, actual.Id);
            }
        }
Exemplo n.º 2
0
        public void ConventionIdLinqSpec_Returns_EntityWithId()
        {
            //Arrange
            const int numOfAuthors = 10;

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

                var spec = new ConventionIdLinqSpec <Author>();

                var qrit = new IdQriteria {
                    Id = 2
                };

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

                //Assert
                Assert.AreEqual(qrit.Id, actual.Cast <Author>().Single().Id);
            }
        }