Skip to content

Commit 6521615

Browse files
ensure that transient factory works as well correct with keyed service
1 parent f30ada7 commit 6521615

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Ninject.Web.AspNetCore.Test/Unit/ServiceProviderKeyedTest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ public void OptionalKeyedServiceCollectionExisting_CorrectServiceResolved()
2929
provider.GetKeyedService(typeof(IWarrior), "Samurai").Should().NotBeNull().And.BeOfType(typeof(Samurai));
3030
provider.GetKeyedService(typeof(IWarrior), "Ninja1").Should().NotBeNull().And.BeOfType(typeof(Ninja)).
3131
And.Match(x => ((Ninja)x).Name == "test");
32-
provider.GetKeyedService(typeof(IWarrior), "Ninja2").Should().NotBeNull().And.BeOfType(typeof(Ninja)).
32+
var ninja2First = provider.GetKeyedService(typeof(IWarrior), "Ninja2");
33+
var ninja2Second = provider.GetKeyedService(typeof(IWarrior), "Ninja2");
34+
ninja2First.Should().NotBeNull().And.BeOfType(typeof(Ninja)).
3335
And.Match(x => ((Ninja)x).Name == "test:Ninja2");
36+
ninja2Second.Should().NotBeNull().And.BeOfType(typeof(Ninja)).
37+
And.Match(x => ((Ninja)x).Name == "test:Ninja2");
38+
ninja2First.Should().NotBeSameAs(ninja2Second);
3439
}
3540

3641
[Fact]

0 commit comments

Comments
 (0)