/// <summary>
        /// Applies the dynamic extensions.
        /// </summary>
        /// <param name="bendyObject">The bendy object.</param>
        public static void ApplyDynamicExtensions <TItemType>(BendyObject bendyObject, IEnumerable <Assembly> dynamicExtensionAssemblies = null)
        {
            IEnumerable <MethodInfo> methods;
            var supportedTypes = new[]
            {
                typeof(BendyObject), typeof(TItemType)
            };

            if (dynamicExtensionAssemblies == null)
            {
                dynamicExtensionAssemblies = TypeFinder.GetFilteredDomainAssemblies().ToArray();
            }

            methods = DynamicExtensionsHelper.GetExtensions(dynamicExtensionAssemblies, supportedTypes);

            ApplyDynamicExtensions <TItemType>(bendyObject, methods);
        }
        public void DynamicExtensionsHelperTests_GetExtensions_ReturnsResults()
        {
            // Arrange
            var assemblies = new []
            {
                typeof(Rebel.Tests.Extensions.TestDynamicExtensions).Assembly
            };
            var supportedTypes = new[]
            {
                typeof(Content),
                typeof(BendyObject)
            };

            // Act
            var methods = DynamicExtensionsHelper.GetExtensions(assemblies, supportedTypes);

            // Assert
            Assert.IsTrue(methods.Any());
        }
        /// <summary>
        /// Applies the dynamic field extensions.
        /// </summary>
        /// <typeparam name="TParentType">The type of the parent item.</typeparam>
        /// <param name="parent">The parent.</param>
        /// <param name="propertyEditorId">The property editor id.</param>
        /// <param name="bendyObject">The bendy object.</param>
        public static void ApplyDynamicFieldExtensions <TParentType>(TParentType parent, string propertyEditorId, BendyObject bendyObject, IEnumerable <Assembly> dynamicExtensionAssemblies = null)
            where TParentType : TypedEntity
        {
            IEnumerable <MethodInfo> methods;
            var supportedTypes = new[]
            {
                typeof(BendyObject),
                typeof(TypedAttribute),
                typeof(TParentType)
            };

            if (dynamicExtensionAssemblies == null)
            {
                dynamicExtensionAssemblies = TypeFinder.GetFilteredDomainAssemblies().ToArray();
            }

            methods = DynamicExtensionsHelper.GetExtensions <DynamicFieldExtensionAttribute>(dynamicExtensionAssemblies, supportedTypes);

            ApplyDynamicFieldExtensions(parent, propertyEditorId, bendyObject, methods);
        }
        public void SetUp()
        {
            var assemblies = new[]
            {
                typeof(Rebel.Tests.Extensions.TestDynamicExtensions).Assembly
            };
            var supportedDynamicTypes = new[]
            {
                typeof(Content),
                typeof(BendyObject)
            };
            var supportedDynamicFieldTypes = new[]
            {
                typeof(Content),
                typeof(TypedAttribute),
                typeof(BendyObject)
            };
            var bendyMethods    = DynamicExtensionsHelper.GetExtensions(assemblies, supportedDynamicTypes);
            var subBendyMethods = DynamicExtensionsHelper.GetExtensions <DynamicFieldExtensionAttribute>(assemblies, supportedDynamicFieldTypes);

            var bendy = new BendyObject();

            BendyObjectExtensionsHelper.ApplyDynamicExtensions <Content>(bendy, bendyMethods);

            var content = new Content();

            _bendy = bendy;
            _bendy["__OriginalItem"] = content;

            var attrType1 = new AttributeType {
                RenderTypeProvider = CorePluginConstants.FileUploadPropertyEditorId
            };
            var attrDef1 = new AttributeDefinition {
                AttributeType = attrType1
            };
            var attr1 = new TypedAttribute(attrDef1);

            var subBendy1 = new BendyObject();

            subBendy1["__OriginalItem"] = attr1;
            subBendy1.AddLazy("__Parent", () => bendy);
            subBendy1["__ParentKey"] = "Test";

            BendyObjectExtensionsHelper.ApplyDynamicFieldExtensions(content, CorePluginConstants.FileUploadPropertyEditorId, subBendy1, subBendyMethods);

            _bendy["Test"] = subBendy1;

            var attrType2 = new AttributeType {
                RenderTypeProvider = CorePluginConstants.TreeNodePickerPropertyEditorId
            };
            var attrDef2 = new AttributeDefinition {
                AttributeType = attrType2
            };
            var attr2 = new TypedAttribute(attrDef2);

            var subBendy2 = new BendyObject();

            subBendy2["__OriginalItem"] = attr2;
            subBendy2.AddLazy("__Parent", () => bendy);
            subBendy2["__ParentKey"] = "Test2";

            BendyObjectExtensionsHelper.ApplyDynamicFieldExtensions(content, CorePluginConstants.TreeNodePickerPropertyEditorId, subBendy2, subBendyMethods);

            _bendy["Test2"] = subBendy2;
        }