public void Navigate() { using (var controller = new PPCRental_Project.Controllers.AccountController()) { _result = controller.Login(); } }
public void Login(string email, string password) { agency = new PPCRental_Project.Controllers.AccountController(); db = new K21T3_Team1_PPC3129Entities(); us = db.USER.FirstOrDefault(d => d.Email == email); var moqContext = new Moq.Mock <ControllerContext>(); var moqSession = new Moq.Mock <HttpSessionStateBase>(); moqContext.Setup(c => c.HttpContext.Session).Returns(moqSession.Object); agency.ControllerContext = moqContext.Object; moqSession.Setup(s => s["UserRole"]).Returns("1"); us.Email = email; us.Password = password; agency.Login(email, password); }