From 3726ea3ab2117174b33fe270e66e5e21432a1ee9 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Thu, 16 Aug 2018 11:07:17 -0700 Subject: [PATCH] Added failing unit test for #718 (skipped) for later testing. --- .../LazyRegistrationSourceTests.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/Autofac.Test/Features/LazyDependencies/LazyRegistrationSourceTests.cs b/test/Autofac.Test/Features/LazyDependencies/LazyRegistrationSourceTests.cs index 900c59078..063b29137 100644 --- a/test/Autofac.Test/Features/LazyDependencies/LazyRegistrationSourceTests.cs +++ b/test/Autofac.Test/Features/LazyDependencies/LazyRegistrationSourceTests.cs @@ -43,5 +43,33 @@ public void WhenLazyIsResolved_ValueIsNotYetCreated() var lazy = container.Resolve>(); Assert.False(lazy.IsValueCreated); } + + [Fact(Skip = "#718")] + public void LazyWorksWithCircularPropertyDependencies() + { + var builder = new ContainerBuilder(); + + builder.RegisterType() + .SingleInstance(); + builder.RegisterType() + .SingleInstance() + .PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies); + + var container = builder.Build(); + Assert.NotNull(container.Resolve()); + } + + private class A + { + public A(Lazy b) + { + var myB = b.Value; + } + } + + private class B + { + public A A { get; set; } + } } }