public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
            switch (result)
            {
                case SignInStatus.Success:
                    return RedirectToLocal(returnUrl);
                case SignInStatus.LockedOut:
                case SignInStatus.RequiresVerification:
                case SignInStatus.Failure:
                default:
                    ModelState.AddModelError("", "Invalid login attempt.");
                    return View(model);
            }
        }
        public void AccountController_Login_Succeeded()
        {
            //Arrange
            var _email = "*****@*****.**";
            var lgnVm = new LoginViewModel { Email = _email, Password = _email, RememberMe = false };

            var userStoreMock = new Mock<IUserStore<ApplicationUser>>();
            var userManagerMck =  new Mock<ApplicationUserManager>(userStoreMock.Object);


            var authManagerMck = new Mock<IAuthenticationManager>();

            Mock<ApplicationSignInManager> signInManagerMck = new Mock<ApplicationSignInManager>(userManagerMck.Object, authManagerMck.Object);

            signInManagerMck.Setup(mck => mck.PasswordSignInAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<bool>())).Returns(
                (string str1, string str2, bool bl1, bool bl2) => Task.FromResult<SignInStatus>(SignInStatus.Success));

            var urlHlprMck = new Mock<UrlHelper>();
            urlHlprMck.Setup(hlpr => hlpr.IsLocalUrl(It.IsAny<string>())).Returns(false);

            var accountController = new AccountController(userManagerMck.Object, signInManagerMck.Object) { Url = urlHlprMck.Object };

            //Act
            var tsk = accountController.Login(lgnVm, "");
            tsk.Wait();
            var rslt = tsk.Result;

            //Assert
            Mock.Get(signInManagerMck.Object).Verify(mck => mck.PasswordSignInAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<bool>()));
            Assert.IsType<RedirectToRouteResult>(rslt);
            Assert.Equal("Index", ((RedirectToRouteResult)rslt).RouteValues["Action"]);
            Assert.Equal("Home", ((RedirectToRouteResult)rslt).RouteValues["Controller"]);
        }