Esempio n. 1
0
 /// <summary>Applies defined modifications to the editors.</summary>
 public virtual void ApplyModifications(ItemDefinition definition, IDictionary <string, Control> addedEditors)
 {
     foreach (string name in addedEditors.Keys)
     {
         foreach (EditorModifierAttribute em in definition.GetModifiers(name))
         {
             Control editor = addedEditors[em.Name];
             em.Modify(editor);
         }
     }
 }
Esempio n. 2
0
        public void ValidateRootDefinition()
        {
            ItemDefinition rootDefinition      = engine.Definitions.GetDefinition(typeof(Definitions.IntegrityRoot));
            ItemDefinition startPageDefinition = engine.Definitions.GetDefinition(typeof(Definitions.IntegrityStartPage));

            Assert.That(rootDefinition.GetAllowedChildren(engine.Definitions, null).Contains(startPageDefinition));
            //EnumerableAssert.Contains(rootDefinition.AllowedChildren, startPageDefinition);
            Assert.IsNull(rootDefinition.AuthorizedRoles);
            Assert.AreEqual(0, rootDefinition.AvailableZones.Count);
            Assert.AreEqual(0, rootDefinition.Containers.Count);
            Assert.IsEmpty(rootDefinition.Description);
            Assert.AreEqual(typeof(Definitions.IntegrityRoot).Name, rootDefinition.Discriminator);
            Assert.That(rootDefinition.Displayables.Count, Is.EqualTo(17));
            Assert.AreEqual(0, rootDefinition.Editables.Count);
            EnumerableAssert.Contains(engine.Definitions.GetAllowedChildren(new Definitions.IntegrityRoot(), null, null), startPageDefinition);
            Assert.AreEqual(0, rootDefinition.Editables.Count);
            Assert.AreEqual(0, rootDefinition.GetModifiers("Title").Count);
            Assert.AreEqual(0, rootDefinition.EditableModifiers.Count);
            Assert.AreEqual(0, rootDefinition.SortOrder);
            Assert.AreEqual(typeof(Definitions.IntegrityRoot).Name, rootDefinition.Title);
        }
Esempio n. 3
0
        public void HasCorrectNumberOfEditorModifiersOnProperty()
        {
            ItemDefinition definition = engine.Definitions.GetDefinition(typeof(ItemWithDetails));

            Assert.AreEqual(1, definition.GetModifiers("TestProperty1").Count);
        }