Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Oct 9, 2020
1 parent 24970cc commit 8c50ad5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions VContainer/Assets/VContainer/Tests/ScopedContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void CreateScopeWithResolveSingleton()
public void CreateScopeWithRegisterSingleton()
{
var builder = new ContainerBuilder();
builder.Register<NoDependencyServiceA>(Lifetime.Singleton);
builder.Register<DisposableServiceA>(Lifetime.Singleton);

var parentContainer = builder.Build();

Expand All @@ -104,8 +104,9 @@ public void CreateScopeWithRegisterSingleton()
childBuilder.Register<ServiceA>(Lifetime.Singleton);
});
{
var parentSingleton = childContainer.Resolve<NoDependencyServiceA>();
Assert.That(parentSingleton, Is.InstanceOf<NoDependencyServiceA>());
var parentSingleton = childContainer.Resolve<DisposableServiceA>();
Assert.That(parentSingleton, Is.InstanceOf<DisposableServiceA>());
Assert.That(parentSingleton, Is.EqualTo(parentContainer.Resolve<DisposableServiceA>()));

var childSingleton = childContainer.Resolve<ServiceA>();
Assert.That(childSingleton, Is.InstanceOf<ServiceA>());
Expand All @@ -118,9 +119,9 @@ public void CreateScopeWithRegisterSingleton()
grandChildBuilder.Register<ServiceB>(Lifetime.Singleton);
});
{
var parentSingleton = grandChildContainer.Resolve<NoDependencyServiceA>();
Assert.That(parentSingleton, Is.InstanceOf<NoDependencyServiceA>());
Assert.That(parentSingleton, Is.EqualTo(parentContainer.Resolve<NoDependencyServiceA>()));
var parentSingleton = grandChildContainer.Resolve<DisposableServiceA>();
Assert.That(parentSingleton, Is.InstanceOf<DisposableServiceA>());
Assert.That(parentSingleton, Is.EqualTo(parentContainer.Resolve<DisposableServiceA>()));

var childSingleton = grandChildContainer.Resolve<ServiceA>();
Assert.That(childSingleton, Is.InstanceOf<ServiceA>());
Expand Down

0 comments on commit 8c50ad5

Please sign in to comment.