模拟UserManager ASP 5

时间:2016-01-18 11:03:02

标签: c# asp.net unit-testing asp.net-identity moq

我在模拟UserManager时遇到了麻烦。

Mocking new Microsoft Entity Framework Identity UserManager and RoleManager的解决方案对我不起作用。因为它需要添加Generic类型。

如果我添加泛型类型,则UserManager会请求optionsAccessor:

  

错误CS7036没有给出符合所需形式参数' optionsAccessor' ' UserManager.UserManager(IUserStore,IOptions,IPasswordHasher,IEnumerable>,IEnumerable>,ILookupNormalizer,IdentityErrorDescriber,IServiceProvider,ILogger>,IHttpContextAccessor)'

这是我的模拟代码:

var mockStore = new Mock<IUserStore<ApplicationUser>>(MockBehavior.Strict);

UserManager<ApplicationUser> userManager = new UserManager<ApplicationUser>(mockStore.Object);

我有什么遗失的吗?或者在当前版本的ASP中我不想要什么?

我正在使用DNX451。由于DNXCore50不支持Moq

0 个答案:

没有答案
相关问题