Skip to content

Commit 8ac296b

Browse files
committed
Add test that showcases internal services can be registered
Related to #107
1 parent 83edbb5 commit 8ac296b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/DependencyInjection.Attributed.Tests/GenerationTests.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77

88
namespace Tests.DependencyInjection;
99

10-
public record GenerationTests(ITestOutputHelper Output)
10+
public class GenerationTests(ITestOutputHelper Output)
1111
{
12+
[Fact]
13+
public void RegisterInternalService()
14+
{
15+
var collection = new ServiceCollection();
16+
collection.AddServices();
17+
var services = collection.BuildServiceProvider();
18+
19+
var instance = services.GetRequiredService<IService>();
20+
}
21+
1222
[Fact]
1323
public void RegisterSingletonService()
1424
{
@@ -335,4 +345,8 @@ public class KeyedByContractName { }
335345
public class DependencyFromKeyedContract([Import("contract")] KeyedByContractName dependency)
336346
{
337347
public KeyedByContractName Dependency => dependency;
338-
}
348+
}
349+
350+
public interface IService { }
351+
[Service]
352+
class InternalService : IService { }

0 commit comments

Comments
 (0)