public void CircularDependenciesCanBeResolved() { MockBuilderContext ctx = CreateContext(); ILifetimeContainer container = ctx.Locator.Get <ILifetimeContainer>(); ctx.Policies.SetDefault <ICreationPolicy>(new DefaultCreationPolicy()); ctx.Policies.SetDefault <ISingletonPolicy>(new SingletonPolicy(true)); CircularDependency1 d1 = (CircularDependency1)ctx.HeadOfChain.BuildUp(ctx, typeof(CircularDependency1), null, null); Assert.IsNotNull(d1); Assert.IsNotNull(d1.Depends2); Assert.IsNotNull(d1.Depends2.Depends1); Assert.AreSame(d1, d1.Depends2.Depends1); Assert.AreEqual(2, container.Count); }
public CircularDependency2(CircularDependency1 depends1) { Depends1 = depends1; }
public CircularDependency2(CircularDependency1 depends1) { Depends1 = depends1; }