public void Activate() { var userRepository = new UserRepositoryMock().GetUserRepoMockedInstance(); var authProvider = new Mock <FormsAuthProvider>(); var tempDataMock = new Mock <TempDataDictionary>(); var accountController = new AccountController(authProvider.Object, userRepository) { TempData = tempDataMock.Object }; var result = accountController.Activate("*****@*****.**", "user2123"); Assert.AreNotEqual("", accountController.TempData["activated"]); }