Пример #1
0
        public void Can_Perform_Delete_With_Heirarchy_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository = ContentTypeRepository;
                ContentType           ctMain     = ContentTypeBuilder.CreateSimpleContentType(defaultTemplateId: 0);
                ContentType           ctChild1   = ContentTypeBuilder.CreateSimpleContentType("child1", "Child 1", ctMain, randomizeAliases: true, defaultTemplateId: 0);
                ContentType           ctChild2   = ContentTypeBuilder.CreateSimpleContentType("child2", "Child 2", ctChild1, randomizeAliases: true, defaultTemplateId: 0);

                repository.Save(ctMain);
                repository.Save(ctChild1);
                repository.Save(ctChild2);

                // Act
                IContentType resolvedParent = repository.Get(ctMain.Id);
                repository.Delete(resolvedParent);

                // Assert
                Assert.That(repository.Exists(ctMain.Id), Is.False);
                Assert.That(repository.Exists(ctChild1.Id), Is.False);
                Assert.That(repository.Exists(ctChild2.Id), Is.False);
            }
        }
Пример #2
0
        public void Can_Perform_Exists_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository = ContentTypeRepository;

                // Act
                bool exists = repository.Exists(_simpleContentType.Id);

                // Assert
                Assert.That(exists, Is.True);
            }
        }
Пример #3
0
        public void Can_Perform_Delete_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository = ContentTypeRepository;

                // Act
                ContentType contentType = ContentTypeBuilder.CreateSimpleContentType(defaultTemplateId: 0);
                repository.Save(contentType);

                IContentType contentType2 = repository.Get(contentType.Id);
                repository.Delete(contentType2);

                bool exists = repository.Exists(contentType.Id);

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