public void InjectsEmptyArrayWhenNoRegisteredInstances()
        {
            GenericObjectArrayConstructorDependency <ILogger> instance
                = ResolveConfiguredObject <GenericObjectArrayConstructorDependency <ILogger> >("emptyArray");

            Assert.AreEqual(0, instance.values.Length);
        }
        public void DefaultRegisteredInstancesAreIgnoredByArrayParameter()
        {
            IUnityContainer container = GetConfiguredContainer("populatedArrayWithDefaultInstance");

            GenericObjectArrayConstructorDependency <ILogger> instance
                = container.Resolve <GenericObjectArrayConstructorDependency <ILogger> >();

            Assert.AreEqual(2, instance.values.Length);
            Assert.AreSame(container.Resolve <ILogger>("logger1"), instance.values[0]);
            Assert.AreSame(container.Resolve <ILogger>("logger2"), instance.values[1]);
        }
        public void InjectsPopulatedArrayWhenInstancesAreRegistered()
        {
            IUnityContainer container = GetConfiguredContainer("populatedArray");

            GenericObjectArrayConstructorDependency <ILogger> instance
                = container.Resolve <GenericObjectArrayConstructorDependency <ILogger> >();

            Assert.AreEqual(2, instance.values.Length);
            Assert.AreSame(container.Resolve <ILogger>("logger1"), instance.values[0]);
            Assert.AreSame(container.Resolve <ILogger>("logger2"), instance.values[1]);
        }
        public void InjectsPopulatedArrayWhenSpecifyingValues()
        {
            IUnityContainer container = GetConfiguredContainer("populatedArrayWithValues");

            GenericObjectArrayConstructorDependency <ILogger> instance
                = container.Resolve <GenericObjectArrayConstructorDependency <ILogger> >();

            Assert.AreEqual(2, instance.values.Length);
            Assert.AreSame(container.Resolve <ILogger>("logger2"), instance.values[0]);
            Assert.AreSame(container.Resolve <ILogger>("logger1"), instance.values[1]);
            Assert.IsNotNull(container.Resolve <ILogger>("logger3"));    // registered, but not in the array
        }