Exemplo n.º 1
0
        public void Can_Perform_Exists_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 exists      = repository.Exists(2);
            var doesntExist = repository.Exists(5);

            // Assert
            Assert.That(exists, Is.True);
            Assert.That(doesntExist, Is.False);
        }
Exemplo n.º 2
0
        public void Can_Perform_Exists_On_RelationRepository()
        {
            // Arrange
            using (IScope scope = ScopeProvider.CreateScope())
            {
                RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType);

                // Act
                bool exists      = repository.Exists(2);
                bool doesntExist = repository.Exists(5);

                // Assert
                Assert.That(exists, Is.True);
                Assert.That(doesntExist, Is.False);
            }
        }
Exemplo n.º 3
0
        public void Can_Delete_Content_And_Verify_Relation_Is_Removed()
        {
            // Arrange
            using (IScope scope = ScopeProvider.CreateScope())
            {
                RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType);

                IContent content = ContentService.GetById(_subpage.Id);
                ContentService.Delete(content, 0);

                // Act
                bool shouldntExist = repository.Exists(1);
                bool shouldExist   = repository.Exists(2);

                // Assert
                Assert.That(shouldntExist, Is.False);
                Assert.That(shouldExist, Is.True);
            }
        }
Exemplo n.º 4
0
        public void Can_Delete_Content_And_Verify_Relation_Is_Removed()
        {
            // Arrange
            var provider       = new PetaPocoUnitOfWorkProvider();
            var unitOfWork     = provider.GetUnitOfWork();
            var repositoryType = new RelationTypeRepository(unitOfWork);
            var repository     = new RelationRepository(unitOfWork, NullCacheProvider.Current, repositoryType);

            var content = ServiceContext.ContentService.GetById(1047);

            ServiceContext.ContentService.Delete(content, 0);

            // Act
            var shouldntExist = repository.Exists(1);
            var shouldExist   = repository.Exists(2);

            // Assert
            Assert.That(shouldntExist, Is.False);
            Assert.That(shouldExist, Is.True);
        }
Exemplo n.º 5
0
        public void Can_Perform_Delete_On_RelationRepository()
        {
            // Arrange
            using (IScope scope = ScopeProvider.CreateScope())
            {
                RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType);

                // Act
                IRelation relation = repository.Get(2);
                repository.Delete(relation);

                bool exists = repository.Exists(2);

                // Assert
                Assert.That(exists, Is.False);
            }
        }
Exemplo n.º 6
0
        public void Can_Perform_Delete_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 relation = repository.Get(2);

            repository.Delete(relation);
            unitOfWork.Commit();

            var exists = repository.Exists(2);

            // Assert
            Assert.That(exists, Is.False);
        }
        public void Can_Perform_Delete_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 relation = repository.Get(2);
            repository.Delete(relation);
            unitOfWork.Commit();

            var exists = repository.Exists(2);

            // Assert
            Assert.That(exists, Is.False);
        }
        public void Can_Delete_Content_And_Verify_Relation_Is_Removed()
        {
            // Arrange
            var provider = new PetaPocoUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repositoryType = new RelationTypeRepository(unitOfWork);
            var repository = new RelationRepository(unitOfWork, NullCacheProvider.Current, repositoryType);

            var content = ServiceContext.ContentService.GetById(1047);
            ServiceContext.ContentService.Delete(content, 0);

            // Act
            var shouldntExist = repository.Exists(1);
            var shouldExist = repository.Exists(2);

            // Assert
            Assert.That(shouldntExist, Is.False);
            Assert.That(shouldExist, Is.True);
        }
        public void Can_Perform_Exists_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 exists = repository.Exists(2);
            var doesntExist = repository.Exists(5);

            // Assert
            Assert.That(exists, Is.True);
            Assert.That(doesntExist, Is.False);
        }