Skip to content

Commit

Permalink
Merge pull request #641 from hadashiA/SupportForValueTypesFuncRegistr…
Browse files Browse the repository at this point in the history
…ation

Added Unit Tests
  • Loading branch information
hadashiA authored Mar 2, 2024
2 parents 4a23aa6 + 0ffc81f commit 6e160f3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions VContainer/Assets/Tests/ContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,19 @@ public void RegisterFromFunc()
Assert.That(resolved, Is.InstanceOf<ServiceA>());
Assert.That(resolved.Service2, Is.InstanceOf<NoDependencyServiceA>());
}

[Test]
public void RegisterValueTypeFromFunc()
{
var builder = new ContainerBuilder();
builder.Register<GenericsService<bool>>(Lifetime.Transient);

builder.Register(_ => true, Lifetime.Scoped);

var container = builder.Build();
var resolved = container.Resolve<GenericsService<bool>>();
Assert.That(resolved.ParameterService, Is.True);
}

[Test]
public void RegisterFromFuncWithInterface()
Expand Down

0 comments on commit 6e160f3

Please sign in to comment.