コード例 #1
0
        public void ConstructingAnDependencyArrayWithNoRegisteredElementsSucceeds()
        {
            IUnityContainer container = new UnityContainer();

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

            Assert.AreEqual(0, resolved.Dependency.Length);
        }
コード例 #2
0
        public void ConstructingAnDependencyArrayWithRegisteredElementsSucceeds()
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterType <CollectionSupportTestClass>("Element1", new ContainerControlledLifetimeManager());
            container.RegisterType <CollectionSupportTestClass>("Element2", new ContainerControlledLifetimeManager());
            container.RegisterType <CollectionSupportTestClass>("Element3", new ContainerControlledLifetimeManager());

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

            Assert.AreEqual(3, resolved.Dependency.Length);
        }