From a8a6315bd2b6b5eddf83bae48349d15596034d86 Mon Sep 17 00:00:00 2001 From: Alon Talmi Date: Wed, 15 Nov 2023 09:08:40 +0100 Subject: [PATCH] Added WithParameter with resolver UnitTests --- VContainer/Assets/Tests/ContainerTest.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/VContainer/Assets/Tests/ContainerTest.cs b/VContainer/Assets/Tests/ContainerTest.cs index 421d6a0f..9ef82f78 100644 --- a/VContainer/Assets/Tests/ContainerTest.cs +++ b/VContainer/Assets/Tests/ContainerTest.cs @@ -429,6 +429,17 @@ public void RegisterWithParameter() var resolved = container.Resolve(); Assert.That(resolved.Service2, Is.EqualTo(paramValue)); } + + { + var builder = new ContainerBuilder(); + builder.Register(Lifetime.Scoped); + builder.Register(Lifetime.Scoped) + .WithParameter(resolver => resolver.Resolve()); + + var container = builder.Build(); + var resolved = container.Resolve(); + Assert.That(resolved.Service2, Is.Not.Null); + } } [Test]