我必须在autofac中注册ihubcontext。我的团队整合测试使用auto来自动解决,如下所示。
[TestMethod]
public async Task TestGetReadyRoundCode()
{
var expected = true;
var target = AutofacConfig.GetContainer(new ServiceCollection(), Config.ConnectionStrings, Config.MongoDBConnectionStrings).Resolve<ILotteryRoundService>();
var result = await target.GetReadyRoundCode(LotteryNameKey.chongqingSSC.ToInt());
Console.Write(JsonConvert.SerializeObject(result, Formatting.Indented));
Assert.AreEqual(expected, result.Success);
}
我尝试过注册信号器的方法。但是要执行抛出。
builder
.RegisterGeneric(typeof(IHubContext<,>))
.As(typeof(IHubContext<,>))
.AsImplementedInterfaces()
.SingleInstance()
.PropertiesAutowired();
我也关注了this link。但是我无法建立成功。
有人可以帮我解决这个问题吗?