Skip to content

Commit

Permalink
Add test case for bug 340
Browse files Browse the repository at this point in the history
  • Loading branch information
aomader committed Sep 28, 2023
1 parent 2d82174 commit a8f6abd
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Shouldly;
using Xunit;

namespace Lamar.Testing.Bugs;

public class Bug_340_open_generic_interface_registration_check
{
class ClassA {}

interface IGenericService<T> {}

class ServiceA : IGenericService<ClassA> {}

[Fact]
public void Test_it()
{
var container = new Container(x =>
{
x.For<IGenericService<ClassA>>().Use<ServiceA>();
});

var x = container.GetInstance<IGenericService<ClassA>>();

container.GetInstance<IGenericService<ClassA>>()
.ShouldNotBeNull();

container.Model.HasRegistrationFor(typeof(IGenericService<>))
.ShouldBeTrue();
}
}

0 comments on commit a8f6abd

Please sign in to comment.