public void then_querying_for_polymorphic_base_returns_all_realized_instances()
        {
            var handlers = lookup.FindInstancesOfConfigurationType(typeof(ExceptionHandlerData));

            Assert.IsTrue(handlers.Where(x => x.ConfigurationType == typeof(ReplaceHandlerData)).Any());
            Assert.IsTrue(handlers.Where(x => x.ConfigurationType == typeof(WrapHandlerData)).Any());
        }
        public void then_contained_elements_are_removed_in_lookup()
        {
            ElementLookup lookup = Container.Resolve <ElementLookup>();

            foreach (var containedElement in removedElement.DescendentElements())
            {
                Assert.IsFalse(lookup.FindInstancesOfConfigurationType(containedElement.ConfigurationType).Where(x => x.Path == containedElement.Path).Any());
            }
        }
        private IEnumerable <ElementViewModel> GetReferencedElements()
        {
            var referenceAttribute = Attributes.OfType <ReferenceAttribute>().FirstOrDefault();

            if (referenceAttribute != null)
            {
                return(elementLookup.FindInstancesOfConfigurationType(referenceAttribute.ScopeType,
                                                                      referenceAttribute.TargetType));
            }

            return(Enumerable.Empty <ElementViewModel>());
        }
Exemple #4
0
            private bool TryCreateScopeElement()
            {
                var foundElement = lookup.FindInstancesOfConfigurationType(referenceAttribute.ScopeType).FirstOrDefault();

                if (foundElement != null)
                {
                    CreateElementScope(foundElement);
                    return(true);
                }

                return(false);
            }
Exemple #5
0
        /// <summary>
        /// The method invoked during execution.
        /// </summary>
        /// <param name="parameter">Data used by the command.  If the command does not require data to be passed, this object can be set to null.
        ///                 </param>
        protected override void InnerExecute(object parameter)
        {
            base.InnerExecute(parameter);

            commandService.ExecuteAddBlockForSection(commandAttribute.SectionName);

            if (commandAttribute.DefaultProviderConfigurationType != null)
            {
                var declaringElement = lookup.FindInstancesOfConfigurationType(commandAttribute.DefaultProviderConfigurationType).FirstOrDefault();
                if (declaringElement != null)
                {
                    object defaultProviderValue = declaringElement.Property(commandAttribute.DefaultProviderConfigurationPropertyName).Value;
                    AddedElementViewModel.Property(commandAttribute.SateliteProviderReferencePropertyName).Value = defaultProviderValue;
                }
            }
        }
        private void SetDefaultDatabase(ElementLookup elementLookUp)
        {
            var element = elementLookUp.FindInstancesOfConfigurationType(typeof(DatabaseSettings)).FirstOrDefault();

            if (element == null)
            {
                return;
            }

            var elementProperty = element.Properties.FirstOrDefault(p => p.PropertyName == "DefaultDatabase");

            if (elementProperty == null)
            {
                return;
            }

            if (elementProperty.Value != null)
            {
                Name.Value = elementProperty.Value;
            }
        }
Exemple #7
0
        private void SetDefaultDatabase(ElementLookup elementLookUp)
        {
            var element = elementLookUp.FindInstancesOfConfigurationType(typeof(DatabaseSettings)).FirstOrDefault();

            if (element == null)
            {
                return;
            }

            var elementProperty = element.Properties.FirstOrDefault(p => p.PropertyName == "DefaultDatabase");

            if (elementProperty == null)
            {
                return;
            }

            if (elementProperty.Value != null)
            {
                Name.Value = elementProperty.Value;
            }
        }
        public void then_element_is_removed_in_lookup()
        {
            ElementLookup lookup = Container.Resolve <ElementLookup>();

            Assert.IsFalse(lookup.FindInstancesOfConfigurationType(typeof(ExceptionTypeData)).Where(x => x.Path == removedElement.Path).Any());
        }
        public void then_conained_elements_are_removed_from_lookup()
        {
            ElementLookup lookup = Container.Resolve <ElementLookup>();

            Assert.IsFalse(lookup.FindInstancesOfConfigurationType(typeof(WrapHandlerData)).Any());
        }
        public void then_section_is_removed_in_lookup()
        {
            ElementLookup lookup = Container.Resolve <ElementLookup>();

            Assert.IsFalse(lookup.FindInstancesOfConfigurationType(typeof(ExceptionHandlingSettings)).Any());
        }