示例#1
0
        public void Check2PropertyDependencyInjectionWorks()
        {
            IUnityContainer            uc   = new UnityContainer();
            My2PropertyDependencyClass obj1 = uc.Resolve <My2PropertyDependencyClass>();

            Assert.IsNotNull(obj1);
            Assert.IsNotNull(obj1.MyFirstObj);
            Assert.IsNotNull(obj1.MySecondObj);
            Assert.IsInstanceOfType(obj1, typeof(My2PropertyDependencyClass));
        }
示例#2
0
        public void Check2PropertyDependencyBuildUpWorks()
        {
            UnityContainer             uc   = new UnityContainer();
            My2PropertyDependencyClass obj1 = new My2PropertyDependencyClass();

            Assert.IsNotNull(obj1);
            Assert.IsNull(obj1.MyFirstObj);
            Assert.IsNull(obj1.MySecondObj);

            uc.BuildUp(obj1);

            Assert.IsNotNull(obj1.MyFirstObj);
            Assert.IsNotNull(obj1.MySecondObj);
        }
示例#3
0
        public void Check2PropertyDependencyBuildUpWorks()
        {
            UnityContainer uc = new UnityContainer();
            My2PropertyDependencyClass obj1 = new My2PropertyDependencyClass();

            Assert.IsNotNull(obj1);
            Assert.IsNull(obj1.MyFirstObj);
            Assert.IsNull(obj1.MySecondObj);
            
            uc.BuildUp(obj1);
            
            Assert.IsNotNull(obj1.MyFirstObj);
            Assert.IsNotNull(obj1.MySecondObj);
        }