protected override void Act()
        {
            Container.RegisterInstance<IWindowsFormsEditorService>(new Mock<IWindowsFormsEditorService>().Object);
            Container.RegisterInstance<IUIService>(new Mock<IUIService>().Object);

            var sectionModel = SectionViewModel.CreateSection(Container,"mock section", new ConfigurationElementWithComponentModelEditor());

            var originalPropertyDescriptor = TypeDescriptor.GetProperties(typeof(ConfigurationElementWithComponentModelEditor)).OfType<PropertyDescriptor>().Where(x => x.Name == "Prop3").First();
            property = sectionModel.CreateElementProperty(sectionModel, new PropertyDescriptorReturnEditor(originalPropertyDescriptor));
        }
        protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock<ConfigurationSectionLocator>();
            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new ElementForValidation();

            var source = new DesignDictionaryConfigurationSource();
            source.Add("testSection", section);

            var sourceModel = Container.Resolve<ConfigurationSourceModel>();
            sourceModel.Load(source);

            Section = sourceModel.Sections.Where(s => s.SectionName == "testSection").Single();

            property = (ElementProperty)Section.Property(ArrangePropertyName());
        }
 private static bool IsKeyItem(ElementProperty property)
 {
     var configPropertyAttribute = property.Attributes.OfType<ConfigurationPropertyAttribute>().FirstOrDefault();
     return (configPropertyAttribute != null && configPropertyAttribute.IsKey == true);
 }
 public void then_readonly_properties_with_editors_dont_offer_editors()
 {
     var exceptionType = model.GetDescendentsOfType<ExceptionTypeData>().First();
     var typeNameProperty = new ElementProperty(Container.Resolve<IServiceProvider>(), 
                                                 exceptionType, 
                                                 TypeDescriptor.GetProperties(typeof(ExceptionTypeData)).OfType<PropertyDescriptor>().Where(x => x.Name == "TypeName").First(), 
                                                 new Attribute[]{new EditorAttribute(typeof(TypeSelectionEditor), typeof(UITypeEditor))});
     Assert.IsTrue(typeNameProperty.ReadOnly);
     Assert.IsTrue(typeNameProperty.BindableProperty is PopupEditorBindableProperty);
     Assert.IsNull(typeNameProperty.BindableProperty.GetEditor(typeof(UITypeEditor)));
 }