From 8ac296bf4c3df5431ce073c0ae19c60de4826810 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Mon, 11 Nov 2024 15:05:55 -0300 Subject: [PATCH] Add test that showcases internal services can be registered Related to #107 --- .../GenerationTests.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection.Attributed.Tests/GenerationTests.cs b/src/DependencyInjection.Attributed.Tests/GenerationTests.cs index 9273fe6..9ecc4fd 100644 --- a/src/DependencyInjection.Attributed.Tests/GenerationTests.cs +++ b/src/DependencyInjection.Attributed.Tests/GenerationTests.cs @@ -7,8 +7,18 @@ namespace Tests.DependencyInjection; -public record GenerationTests(ITestOutputHelper Output) +public class GenerationTests(ITestOutputHelper Output) { + [Fact] + public void RegisterInternalService() + { + var collection = new ServiceCollection(); + collection.AddServices(); + var services = collection.BuildServiceProvider(); + + var instance = services.GetRequiredService(); + } + [Fact] public void RegisterSingletonService() { @@ -335,4 +345,8 @@ public class KeyedByContractName { } public class DependencyFromKeyedContract([Import("contract")] KeyedByContractName dependency) { public KeyedByContractName Dependency => dependency; -} \ No newline at end of file +} + +public interface IService { } +[Service] +class InternalService : IService { } \ No newline at end of file