Exemplo n.º 1
0
        public void OptionalParametersResolvedIfTypeRegistered()
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterType <TestObject>();

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

            Assert.IsNotNull(result.TestObject);
        }
Exemplo n.º 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);
        }