1

I'm having trouble Mocking the UserManager.

The solution of Mocking new Microsoft Entity Framework Identity UserManager and RoleManager does not work for me. Since it requires a Generic type to be added.

And if I add a generic type the method UserManager asks for an optionsAccessor:

Error CS7036 There is no argument given that corresponds to the required formal parameter 'optionsAccessor' of 'UserManager.UserManager(IUserStore, IOptions, IPasswordHasher, IEnumerable>, IEnumerable>, ILookupNormalizer, IdentityErrorDescriber, IServiceProvider, ILogger>, IHttpContextAccessor)'

This is the Mock Code i have:

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

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

Is there something I am missing? Or is it not possible what I want in the current version of ASP?

I am using DNX451. Since DNXCore50 does not support Moq yet

Community
  • 1
  • 1
Martiveen
  • 45
  • 5

0 Answers0