コード例 #1
0
        public void NewsList_IsntAllowed_OnTextPage()
        {
            ItemDefinition definition       = definitions.GetDefinition(typeof(DefinitionTextPage));
            var            childDefinitions = definitions.GetAllowedChildren(new DefinitionTextPage(), "Right", user);

            EnumerableAssert.DoesntContain(childDefinitions, definitions.GetDefinition(typeof(DefinitionNewsList)));
        }
コード例 #2
0
        public void Teaser_IsntAllowed_OnStartPage_LeftAndCenterZone()
        {
            ItemDefinition definition       = definitions.GetDefinition(typeof(DefinitionStartPage));
            var            childDefinitions = definitions.GetAllowedChildren(new DefinitionStartPage(), "LeftAndCenter", user);

            EnumerableAssert.DoesntContain(childDefinitions, definitions.GetDefinition(typeof(DefinitionRightColumnTeaser)));
        }
コード例 #3
0
        public void Teaser_IsntAllowed_WithoutZone()
        {
            ItemDefinition definition       = definitions.GetDefinition(typeof(DefinitionStartPage));
            var            childDefinitions = definitions.GetAllowedChildren(new DefinitionStartPage(), string.Empty, user);

            EnumerableAssert.DoesntContain(childDefinitions, definitions.GetDefinition(typeof(DefinitionTextItem)));
        }
コード例 #4
0
        public void StartPage_IsntAllowed_BelowStartPage()
        {
            ItemDefinition startPageDef     = definitions.GetDefinition(typeof(DefinitionStartPage));
            var            childDefinitions = definitions.GetAllowedChildren(new DefinitionStartPage(), string.Empty, user);

            EnumerableAssert.DoesntContain(childDefinitions, startPageDef, "One of the start page's child definitions was the start page itself.");
        }
コード例 #5
0
        public void DoesntAddItemsInOffPaths()
        {
            ItemHierarchyNavigator ih = new ItemHierarchyNavigator(new BranchHierarchyBuilder(a_a_a, null));

            EnumerableAssert.Count(5, ih.EnumerateAllItems());
            EnumerableAssert.Contains(ih.EnumerateAllItems(), a_a_a);
            EnumerableAssert.DoesntContain(ih.EnumerateAllItems(), a_b_a);
        }
コード例 #6
0
        public void DisabledDefinition_DoesntShowUp_InAllowedChildDefinitions()
        {
            ItemDefinition         definition         = definitions.GetDefinition(typeof(DefinitionTextPage));
            ItemDefinition         replacedDefinition = definitions.GetDefinition(typeof(DefinitionReplaced));
            IList <ItemDefinition> allowedChildren    = definitions.GetAllowedChildren(new DefinitionTextPage(), null, null);

            EnumerableAssert.DoesntContain(allowedChildren, replacedDefinition);
        }
コード例 #7
0
        public void Undefined_ContentItem_IsNotAllowedAsChild()
        {
            ItemDefinition definition          = definitions.GetDefinition(typeof(DefinitionTextPage));
            ItemDefinition undefinedDefinition = definitions.GetDefinition(typeof(DefinitionUndefined));

            IList <ItemDefinition> allowedChildren = definitions.GetAllowedChildren(new DefinitionTextPage(), null, null);

            EnumerableAssert.DoesntContain(allowedChildren, undefinedDefinition);
        }
コード例 #8
0
        public void BuildHierarchyTree_OtherNodes_AreNotIncluded()
        {
            HierarchyNode <ContentItem> node = new TreeHierarchyBuilder(a_b).Build();
            ItemHierarchyNavigator      ih   = new ItemHierarchyNavigator(node);

            EnumerableAssert.DoesntContain(ih.EnumerateAllItems(), a);
            EnumerableAssert.DoesntContain(ih.EnumerateAllItems(), a_a);
            EnumerableAssert.DoesntContain(ih.EnumerateAllItems(), a_a_a);
        }
コード例 #9
0
        public void Item_WithNoneAuthorized_IsntAllowed()
        {
            ItemDefinition autoDefinition = definitions.GetDefinition(typeof(DefinitionAutoCreatedItem));

            foreach (ItemDefinition definition in definitions.GetDefinitions())
            {
                IEnumerable <ItemDefinition> allowedDefinitions = definitions.GetAllowedChildren(Activator.CreateInstance(definition.ItemType) as ContentItem, string.Empty, user);
                EnumerableAssert.DoesntContain(allowedDefinitions, autoDefinition);
            }
        }
コード例 #10
0
        public void ReplaceDefinitionsAttribute_CanDisable_TheSuppliedDefinitions()
        {
            ItemDefinition definition            = definitions.GetDefinition(typeof(DefinitionTextPage));
            ItemDefinition definitionOne         = definitions.GetDefinition(typeof(DefinitionOne));
            ItemDefinition definitionReplacement = definitions.GetDefinition(typeof(DefinitionReplacesNumber1));

            IList <ItemDefinition> allowedChildren = definitions.GetAllowedChildren(new DefinitionTextPage(), null, null);

            EnumerableAssert.DoesntContain(allowedChildren, definitionOne, "Definition one shouldn't be in the list since it isn't enabled");
            EnumerableAssert.Contains(allowedChildren, definitionReplacement);
        }
コード例 #11
0
        public void Item_WithNoneAuthorized_CanBeFiltered()
        {
            ItemDefinition autoDefinition = definitions.GetDefinition(typeof(DefinitionAutoCreatedItem));

            foreach (ItemDefinition definition in definitions.GetDefinitions())
            {
                var parent             = Activator.CreateInstance(definition.ItemType) as ContentItem;
                var allDefinitions     = definitions.GetAllowedChildren(parent, string.Empty);
                var allowedDefinitions = allDefinitions.WhereAuthorized(new SecurityManager(new ThreadContext(), new EditSection()), user, parent);
                EnumerableAssert.DoesntContain(allowedDefinitions, autoDefinition);
            }
        }
コード例 #12
0
        public void AddTo_CanBeAddedToNull()
        {
            AnItem parent = new AnItem();
            AnItem child  = new AnItem();

            child.AddTo(parent);
            Assert.AreEqual(parent, child.Parent);
            EnumerableAssert.Contains(parent.Children, child);

            child.AddTo(null);
            Assert.IsNull(child.Parent);
            EnumerableAssert.DoesntContain(parent.Children, child);
        }
コード例 #13
0
        public void AddTo_IsRemovedFrom_PreviousParentChildren()
        {
            AnItem parent1 = new AnItem();
            AnItem parent2 = new AnItem();
            AnItem child   = new AnItem();

            child.AddTo(parent1);
            EnumerableAssert.Contains(parent1.Children, child);
            EnumerableAssert.DoesntContain(parent2.Children, child);

            child.AddTo(parent2);
            EnumerableAssert.DoesntContain(parent1.Children, child);
            EnumerableAssert.Contains(parent2.Children, child);
        }