public void ConfiguringCtorInjectionYieldsProperlyInjectedObject()
        {
            IUnityContainer container = GetContainer("ConfiguringCtorInjectionYieldsProperlyInjectedObject");

            ConfigurationCollectionSupportTestClass resolved = container.Resolve <ConfigurationCollectionSupportTestClass>();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayProperty);
            Assert.IsNull(resolved.ArrayMethod);
            Assert.AreEqual(3, resolved.ArrayCtor.Length);
        }
        public void ConfiguringPropertyInjectionYieldsProperlyInjectedObject_Specified()
        {
            IUnityContainer container = new UnityContainer();

            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor <ConfigurationCollectionSupportTestClass>(
                new InjectionProperty("ArrayProperty", new ResolvedArrayParameter <CollectionSupportTestClass>(new CollectionSupportTestClass())));

            ConfigurationCollectionSupportTestClass resolved = container.Resolve <ConfigurationCollectionSupportTestClass>();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayCtor);
            Assert.IsNull(resolved.ArrayMethod);
            Assert.AreEqual(1, resolved.ArrayProperty.Length);
        }
        public void ConfiguringMethodInjectionYieldsProperlyInjectedObject()
        {
            IUnityContainer container = new UnityContainer();

            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor <ConfigurationCollectionSupportTestClass>(
                new InjectionMethod("InjectionMethod", new ResolvedParameter <CollectionSupportTestClass[]>()));

            ConfigurationCollectionSupportTestClass resolved = container.Resolve <ConfigurationCollectionSupportTestClass>();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayCtor);
            Assert.IsNull(resolved.ArrayProperty);
            Assert.AreEqual(0, resolved.ArrayMethod.Length);
        }
        public void ConfiguringPropertyInjectionYieldsProperlyInjectedObject()
        {
            IUnityContainer container = new UnityContainer();

            // RL: Change from obsolete to newer method?
            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor <ConfigurationCollectionSupportTestClass>(
                new InjectionProperty("ArrayProperty", new ResolvedParameter <CollectionSupportTestClass[]>()));

            ConfigurationCollectionSupportTestClass resolved = container.Resolve <ConfigurationCollectionSupportTestClass>();

            Assert.IsNotNull(resolved);
            Assert.IsNull(resolved.ArrayCtor);
            Assert.IsNull(resolved.ArrayMethod);
            Assert.AreEqual(0, resolved.ArrayProperty.Length);
        }
        public void ConfiguringPropertyInjectionYieldsProperlyInjectedObject_Elements()
        {
            IUnityContainer container = new UnityContainer();

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

            container.Configure <InjectedMembers>()
            .ConfigureInjectionFor <ConfigurationCollectionSupportTestClass>(
                new InjectionProperty("ArrayProperty", new ResolvedParameter <CollectionSupportTestClass[]>()));

            ConfigurationCollectionSupportTestClass resolved = container.Resolve <ConfigurationCollectionSupportTestClass>();

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