Mocking - cannot instantiate proxy class of property?
Create a mock object of UserManager
first. Then setup its virtual method FindByIdAsync
(given that the type of the property UserManager
is a class AppUserManager
and lets say this class implements IAppUserManager
).
var yourMockOfUserManager = new Mock<IAppUserManager>();
yourMockOfUserManage.Setup(x=>x.FindByIdAsync(It.IsAny<string>())).Returns(() => null);
and finally
mockOwinManager.Setup(x => x.UserManager).Returns(() => yourMockOfUserManager.Object);