public void UIComponentMetadata_ComponentDefinitionAttribute_ForControl()
        {
            var defaultComponentDefinition = _metadata.ComponentDefinitionAttribute;

            defaultComponentDefinition.ScopeXPath.Should().Be(ScopeDefinitionAttribute.DefaultScopeXPath);
            defaultComponentDefinition.ComponentTypeName.Should().Be("control");

            var componentDefinition = new ControlDefinitionAttribute("component");

            Component.Add(componentDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(componentDefinition);

            var globalDefinition = new ControlDefinitionAttribute("global");

            Global.Add(globalDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(globalDefinition);

            var assemblyDefinition = new ControlDefinitionAttribute("assembly");

            Assembly.Add(assemblyDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(assemblyDefinition);

            var parentComponentDefinition = new ControlDefinitionAttribute("parent-component");

            ParentComponent.Add(parentComponentDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(assemblyDefinition);

            var targetedParentComponentDefinition = new ControlDefinitionAttribute("parent-component-targeted")
            {
                TargetAnyType = true
            };

            ParentComponent.Add(targetedParentComponentDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(targetedParentComponentDefinition);

            var declaredDefinition = new ControlDefinitionAttribute("declared");

            Declared.Add(declaredDefinition);

            _metadata.ComponentDefinitionAttribute.Should().BeSameAs(declaredDefinition);
        }
Ejemplo n.º 2
0
        public void UIComponentMetadata_ComponentDefinitionAttribute_ForControl()
        {
            metadata.ComponentDefinitionAttribute.Should().BeNull();

            var componentDefinition = new ControlDefinitionAttribute("component");

            Component.Add(componentDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(componentDefinition);

            var globalDefinition = new ControlDefinitionAttribute("global");

            Global.Add(globalDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(globalDefinition);

            var assemblyDefinition = new ControlDefinitionAttribute("assembly");

            Assembly.Add(assemblyDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(assemblyDefinition);

            var parentComponentDefinition = new ControlDefinitionAttribute("parent-component");

            ParentComponent.Add(parentComponentDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(assemblyDefinition);

            var targetedParentComponentDefinition = new ControlDefinitionAttribute("parent-component-targeted")
            {
                TargetAnyType = true
            };

            ParentComponent.Add(targetedParentComponentDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(targetedParentComponentDefinition);

            var declaredDefinition = new ControlDefinitionAttribute("declared");

            Declared.Add(declaredDefinition);

            metadata.ComponentDefinitionAttribute.Should().BeSameAs(declaredDefinition);
        }