Mocking new Microsoft Entity Framework Identity UserManager and RoleManager

后端 未结 6 511
我寻月下人不归
我寻月下人不归 2020-12-08 13:46

Has anyone come up with a successful mocking solution for UserManager and RoleManager? I have been beating my head against a wall all day. All I wa

6条回答
  •  无人及你
    2020-12-08 13:54

    Just to expand on Rubito's answer, here is how I did it for RoleManager:

    public static Mock> GetMockRoleManager()
    {
       var roleStore = new Mock>();
       return new Mock>(
                    roleStore.Object,null,null,null,null);
    
    }
    

提交回复
热议问题