henrikh
henrikh

Reputation: 31

Lightinject and xUnit InjectData

I'm trying to setup xUnit with the LightInject framework but cannot get the xUnit InlineDataAttribute to work. The following test code doesn't work:

public static void Configure(IServiceContainer container)
{
    container.Register<FooController>();                        
}

[Theory, InjectData, InlineData("data")]
public void Test_GetViolations_Should_Return_A_Non_Empty_List(FooController service, string somedata)
{
    Assert.NotEmpty(service.GetViolations(somedata));
}

This gives an error saying that it cannot find anything to inject for the parameter somedata. Removing the InlineDataAttribute will make the injection work. I really like the InlineData feature of xUnit so how do I get it to work with LightInject?

Upvotes: 1

Views: 250

Answers (1)

henrikh
henrikh

Reputation: 31

This has been fixed by the LightInject author. Now it's possible to do this.

Upvotes: 2

Related Questions