public void TestAccountLoginPostInvalidModel()
 {
     var loginViewModel = new AspnetIdentitySample.Models.LoginViewModel { };
     var accountController = CreateAccountController(loginViewModel);
     var result = accountController.Login(loginViewModel, null);
     Assert.IsInstanceOfType(result.Result, typeof(ViewResult));
 }
        public void TestAccountLoginPostInvalidModel()
        {
            var loginViewModel    = new AspnetIdentitySample.Models.LoginViewModel {
            };
            var accountController = CreateAccountController(loginViewModel);
            var result            = accountController.Login(loginViewModel, null);

            Assert.IsInstanceOfType(result.Result, typeof(ViewResult));
        }
        public async Task<ActionResult> Index(LoginViewModel model, string returnUrl) {
//            

            UserManager.ClaimsIdentityFactory = new MyClaimsIdentityFactory<ApplicationUser>();

            var user = await UserManager.FindAsync(model.Email, model.Password);

            var claimsIdentity =
                await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);

            var authManager = HttpContext.GetOwinContext().Authentication;
            authManager.SignIn(claimsIdentity);

            return RedirectToLocal(returnUrl);
        }