Skip to content

Commit 3726ea3

Browse files
committed
Added failing unit test for #718 (skipped) for later testing.
1 parent 2fd1ae0 commit 3726ea3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/Autofac.Test/Features/LazyDependencies/LazyRegistrationSourceTests.cs

+28
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,33 @@ public void WhenLazyIsResolved_ValueIsNotYetCreated()
4343
var lazy = container.Resolve<Lazy<object>>();
4444
Assert.False(lazy.IsValueCreated);
4545
}
46+
47+
[Fact(Skip = "#718")]
48+
public void LazyWorksWithCircularPropertyDependencies()
49+
{
50+
var builder = new ContainerBuilder();
51+
52+
builder.RegisterType<A>()
53+
.SingleInstance();
54+
builder.RegisterType<B>()
55+
.SingleInstance()
56+
.PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies);
57+
58+
var container = builder.Build();
59+
Assert.NotNull(container.Resolve<A>());
60+
}
61+
62+
private class A
63+
{
64+
public A(Lazy<B> b)
65+
{
66+
var myB = b.Value;
67+
}
68+
}
69+
70+
private class B
71+
{
72+
public A A { get; set; }
73+
}
4674
}
4775
}

0 commit comments

Comments
 (0)