Skip to content

Commit

Permalink
Added WithParameter with resolver UnitTests
Browse files Browse the repository at this point in the history
AlonTalmi authored and hadashiA committed Mar 2, 2024
1 parent 1d3b841 commit a8a6315
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions VContainer/Assets/Tests/ContainerTest.cs
Original file line number Diff line number Diff line change
@@ -429,6 +429,17 @@ public void RegisterWithParameter()
var resolved = container.Resolve<HasMethodInjection>();
Assert.That(resolved.Service2, Is.EqualTo(paramValue));
}

{
var builder = new ContainerBuilder();
builder.Register<I2, NoDependencyServiceA>(Lifetime.Scoped);
builder.Register<HasMethodInjection>(Lifetime.Scoped)
.WithParameter(resolver => resolver.Resolve<I2>());

var container = builder.Build();
var resolved = container.Resolve<HasMethodInjection>();
Assert.That(resolved.Service2, Is.Not.Null);
}
}

[Test]

0 comments on commit a8a6315

Please sign in to comment.