public void UsersViewTest() { // Arrange var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "users") .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) .Options; var context = new ApplicationDbContext(options); var emailSender = new Mock <IEmailSender>(); var taskRep = new Mock <TaskRepository>(context); var userRep = new Mock <UserRepository>(context); var mapper = new Mock <IMapper>(); var userService = new Mock <UserService>(userRep.Object, mapper.Object); var catRep = new Mock <CategoryRepository>(context); var taskCatRep = new Mock <TaskCategoryRepository>(context); var service = new Mock <TaskService>(taskRep.Object, userRep.Object, catRep.Object, taskCatRep.Object, mapper.Object); var mockUserManager = new Mock <UserManager <UserProfile> >( new Mock <IUserStore <UserProfile> >().Object, new Mock <IOptions <IdentityOptions> >().Object, new Mock <IPasswordHasher <UserProfile> >().Object, new IUserValidator <UserProfile> [0], new IPasswordValidator <UserProfile> [0], new Mock <ILookupNormalizer>().Object, new Mock <IdentityErrorDescriber>().Object, new Mock <IServiceProvider>().Object, new Mock <ILogger <UserManager <UserProfile> > >().Object); var controller = new UserManagementController(mockUserManager.Object, service.Object, userService.Object, emailSender.Object); var view = controller.Users(); Assert.IsType <ViewResult>(view); }