public void Configuration_CanAdd_Editable_ToDefinition() { DefinitionElement definitionElement = new DefinitionElement { Name = "DefinitionTextPage" }; definitionElement.Containers.Add(new ContainableElement { Name = "X", Type = typeof(EditableCheckBoxAttribute).AssemblyQualifiedName }); var definitionCollection = new DefinitionCollection(); definitionCollection.Add(definitionElement); DefinitionBuilder builder = new DefinitionBuilder(new DefinitionMap(), typeFinder, new EngineSection { Definitions = definitionCollection }); var definitions = builder.GetDefinitions(); var textPageDefinition = definitions .Single(d => d.ItemType == typeof(DefinitionTextPage)); var textEditors = textPageDefinition.Editables .Where(e => e.GetType() == typeof(EditableCheckBoxAttribute)); Assert.That(textEditors.Count(), Is.EqualTo(1)); }
public void Configuration_CanRemove_Editable_FromDefinition() { DefinitionElement definitionElement = new DefinitionElement { Name = "DefinitionTextPage" }; definitionElement.Containers.Remove(new ContainableElement { Name = "Text" }); var definitionCollection = new DefinitionCollection(); definitionCollection.Add(definitionElement); DefinitionBuilder builder = new DefinitionBuilder(typeFinder, new EngineSection { Definitions = definitionCollection }); var definitions = builder.GetDefinitions(); var textPageDefinition = definitions .Single(d => d.ItemType == typeof(DefinitionTextPage)); var textEditors = textPageDefinition.Editables .Where(e => e.GetType() == typeof(EditableFreeTextAreaAttribute)); Assert.That(textEditors.Count(), Is.EqualTo(0)); }