Skip to content

Commit

Permalink
Add test that showcases internal services can be registered
Browse files Browse the repository at this point in the history
Related to #107
  • Loading branch information
kzu committed Nov 11, 2024
1 parent 83edbb5 commit 8ac296b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/DependencyInjection.Attributed.Tests/GenerationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IService>();
}

[Fact]
public void RegisterSingletonService()
{
Expand Down Expand Up @@ -335,4 +345,8 @@ public class KeyedByContractName { }
public class DependencyFromKeyedContract([Import("contract")] KeyedByContractName dependency)
{
public KeyedByContractName Dependency => dependency;
}
}

public interface IService { }
[Service]
class InternalService : IService { }

0 comments on commit 8ac296b

Please sign in to comment.