Example #1
0
        public void TestRecursiveResolutionWhenEnabledOkForAcyclicDependencies()
        {
            var ioc = new IocContainer(allowRecursiveResolution: true);

            ioc.Bind <IServiceLocator>(() => ioc);
            ioc.Bind <IExampleA, RecursiveNonCyclicA>();
            ioc.Bind <IExampleB, RecursiveNonCyclicB>();

            IExampleB resolved = ioc.Resolve <IExampleB>();

            Assert.IsInstanceOfType(resolved, typeof(RecursiveNonCyclicB));
        }
Example #2
0
 public ExampleA(IServiceLocator ioc)
 {
     b = ioc.GetInstance <IExampleB>();
 }