예제 #1
0
        public void OptionalParametersResolvedIfTypeRegistered()
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterType <TestObject>();

            OptionalConstParameterClass1 result = container.Resolve <OptionalConstParameterClass1>();

            Assert.IsNotNull(result.TestObject);
        }
예제 #2
0
        public void OptionalParametersResolvedIfTypeRegisteredInParent()
        {
            IUnityContainer parent = new UnityContainer();
            IUnityContainer child  = parent.CreateChildContainer();

            parent.RegisterType <TestObject>();

            OptionalConstParameterClass1 result = child.Resolve <OptionalConstParameterClass1>();

            Assert.IsNotNull(result.TestObject);
        }