Пример #1
0
        public void ShouldCreateNonBeanWithCreateBeanMethod()
        {
            var pdi = new DependencyInjector();

            (var nonBean, var @is) = pdi.CreateBean <NonBean>();
            Assert.IsNotNull(nonBean);
        }
Пример #2
0
 public void ShouldCreateBeanWithCreateBeanMethod()
 {
     try
     {
         var pdi = new DependencyInjector();
         (var unnamedBean, var @is) = pdi.CreateBean <UnnamedBean>();
         Assert.IsNotNull(unnamedBean);
         (var _, var is2) = pdi.CreateAndInjectDependencies(unnamedBean, @is
                                                            , rootBeanSpec: new RootBeanSpec(rootBeanName: "BeanWithAName")
                                                            );
         (var bean, var is3) = pdi.CreateAndInjectDependencies <Bean>(is2);
         Assert.IsNotNull(bean?.RefToUnnamedBean);
     }
     catch (DIException dix)
     {
         Console.WriteLine(dix.Diagnostics.AllToString());
         Assert.Fail();
     }
 }