public void ConfiguringGenericPropertyInjectionYieldsProperlyInjectedObject()
        {
            IUnityContainer container = new UnityContainer();

            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor(typeof(ConfigurationCollectionSupportTestClassGeneric <>),
                                   new InjectionProperty("ArrayProperty", new GenericResolvedArrayParameter("T")));

            ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> resolved = container.Resolve <ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> >();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayCtor);
            Assert.IsNull(resolved.ArrayMethod);
            Assert.AreEqual(0, resolved.ArrayProperty.Length);
        }
        public void ConfiguringGenericCtorWithInvalidItemThrows()
        {
            IUnityContainer container = GetContainer("ConfiguringGenericCtorWithInvalidItemThrows");

            ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> resolved = container.Resolve <ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> >();

            Assert.AreEqual(2, resolved.ArrayCtor.Length);
        }
        public void ConfiguringGenericMethodInjectionYieldsProperlyInjectedObject_Elements()
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterType <CollectionSupportTestClass>("element", new ContainerControlledLifetimeManager());

            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor(typeof(ConfigurationCollectionSupportTestClassGeneric <>),
                                   new InjectionMethod("InjectionMethod", new GenericParameter("T[]")));

            ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> resolved = container.Resolve <ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> >();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayCtor);
            Assert.IsNull(resolved.ArrayProperty);
            Assert.AreEqual(1, resolved.ArrayMethod.Length);
        }
        public void ConfiguringGenericCtorInjectionYieldsProperlyInjectedObject()
        {
            IUnityContainer container = GetContainer("ConfiguringGenericCtorInjectionYieldsProperlyInjectedObject");

            ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> resolved = container.Resolve <ConfigurationCollectionSupportTestClassGeneric <CollectionSupportTestClass> >();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayProperty);
            Assert.IsNull(resolved.ArrayMethod);
            Assert.AreEqual(3, resolved.ArrayCtor.Length);
        }