有谁知道使这个测试工作缺少什么?遗憾的是它不能开箱即用。
class A { }
class B { public B(A a) { } }
class C { public C(B b) { } }
[Test]
public void SuperFactoryResolutionTest()
{
var builder = new ContainerBuilder();
builder.RegisterType<B>();
builder.RegisterType<C>();
using (var container = builder.Build())
{
Assert.DoesNotThrow(() =>
{
var factory = container.Resolve<Func<A, C>>();
var x = factory(new A());
});
}
}