Ejemplo n.º 1
0
        public void Can_Perform_GetByQuery_On_RelationRepository()
        {
            // Arrange
            var provider       = new PetaPocoUnitOfWorkProvider();
            var unitOfWork     = provider.GetUnitOfWork();
            var repositoryType = new RelationTypeRepository(unitOfWork);
            var repository     = new RelationRepository(unitOfWork, NullCacheProvider.Current, repositoryType);

            // Act
            var query = Query <Relation> .Builder.Where(x => x.RelationTypeId == 2);

            var relations = repository.GetByQuery(query);

            // Assert
            Assert.That(relations, Is.Not.Null);
            Assert.That(relations.Any(), Is.True);
            Assert.That(relations.Any(x => x == null), Is.False);
            Assert.That(relations.Count(), Is.EqualTo(2));
        }
        public void Can_Perform_GetByQuery_On_RelationRepository()
        {
            // Arrange
            var provider = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repositoryType = new RelationTypeRepository(unitOfWork);
            var repository = new RelationRepository(unitOfWork, NullCacheProvider.Current, repositoryType);

            // Act
            var query = Query<Relation>.Builder.Where(x => x.RelationTypeId == 2);
            var relations = repository.GetByQuery(query);

            // Assert
            Assert.That(relations, Is.Not.Null);
            Assert.That(relations.Any(), Is.True);
            Assert.That(relations.Any(x => x == null), Is.False);
            Assert.That(relations.Count(), Is.EqualTo(2));
        }