【发布时间】:2017-04-17 11:41:02
【问题描述】:
我点击此链接https://github.com/dennisroche/xunit.ioc.autofac 使用 autofac 创建 XUnit 测试,但出现错误
请求的服务“Xunit.Sdk.TestOutputHelper”尚未注册。为避免此异常,请注册组件以提供服务,使用 IsRegistered() 检查服务注册,或使用 ResolveOptional() 方法解决可选依赖项。 我添加了以下代码:
builder.Register(context => new TestOutputHelper())
.As<ITestOutputHelper>()
.InstancePerLifetimeScope();
我错过了上面链接中的任何内容吗?
【问题讨论】: