public static void Login(UserLoginDto dto) { EnvironmentServices.SetEnvironment(dto.Environment); var criteria = new LoginCriteria { UserName = dto.UserName, Password = dto.Password }; GenFormPrincipal.Login(criteria); }
public static void Login(UserLoginDto dto) { EnvironmentServices.SetEnvironment(dto.Environment); var criteria = new LoginCriteria { UserName = dto.UserName, Password = dto.Password }; GenFormPrincipal.Login(criteria); }
public void Init() { _principal = Isolate.Fake.Instance<GenFormPrincipal>(); _identity = Isolate.Fake.Instance<IGenFormIdentity>(); Isolate.WhenCalled(() => _principal.Identity).WillReturn(_identity); Isolate.WhenCalled(() => GenFormPrincipal.GetPrincipal()).WillReturn(_principal); Isolate.WhenCalled(() => GenFormPrincipal.Login(_criteria)).IgnoreCall(); Isolate.WhenCalled(() => EnvironmentServices.SetEnvironment(string.Empty)).IgnoreCall(); _dto = GetAdminUserDto(); }
public ActionResult Login(UserLoginDto dto) { var success = !string.IsNullOrEmpty(GetEnvironment(dto)); if (success) { SessionStateManager.InitializeDatabase(HttpContext.Session); LoginServices.Login(dto); success = LoginServices.IsLoggedIn(dto.UserName); if (success) SetLoginCookie(dto.UserName); } else { return this.Direct(new {success = false, message = NoEnvironmentMessage}); } return this.Direct(new { success }); }
private void IsolateUserHasPasswordMethod() { _dto = GetAdminUserDto(); var user = Isolate.Fake.Instance<IUser>(); var password = _dto.Password; var userName = _dto.UserName; Isolate.WhenCalled(() => user.Password).WillReturn(password); Isolate.WhenCalled(() => UserServices.GetUserByName(userName)).WillReturn(user); }
private static UserLoginDto GetAdminUserDto() { var dto = new UserLoginDto { UserName = "******", Password = "******", Environment = "TestGenForm" }; return dto; }
public void MyTestInitialize() { _sessionState = Isolate.Fake.Instance<HttpSessionStateBase>(); ObjectFactory.Configure(x => x.For<HttpSessionStateBase>().Use(_sessionState)); _controller = ObjectFactory.GetInstance<LoginController>(); Isolate.WhenCalled(() => EnvironmentServices.SetEnvironment("Test")).IgnoreCall(); Isolate.WhenCalled(() => SessionStateManager.InitializeDatabase(_sessionState)).IgnoreCall(); _user = new UserLoginDto { UserName = "******", Password = "******", Environment = Testgenform }; Isolate.WhenCalled(() => LoginServices.Login(_user)).IgnoreCall(); _response = Isolate.Fake.Instance<HttpResponseBase>(); Isolate.WhenCalled(() =>_controller.Response).WillReturn(_response); _context = Isolate.Fake.Instance<HttpContextBase>(); Isolate.WhenCalled(() => _controller.HttpContext).WillReturn(_context); Isolate.WhenCalled(() => _context.Session).WillReturn(_sessionState); }
public ActionResult Login(UserLoginDto login) { var success = login.UserName == "Admin" && login.Password == "Admin" && !string.IsNullOrWhiteSpace(login.Environment); return this.Direct(new { success }); }
public static bool UserHasPassword(UserLoginDto userLoginDto) { return UserServices.GetUserByName(userLoginDto.UserName).Password == userLoginDto.Password; }
public static void ChangePassword(UserLoginDto loginCriteria, string newPassword) { throw new System.NotImplementedException(); }
private string GetEnvironment(UserLoginDto dto) { if (!string.IsNullOrEmpty(dto.Environment)) SetEnvironment(dto.Environment); if (HttpContext.Session != null) return (string)HttpContext.Session[EnvironmentSetting]; return string.Empty; }
public static bool UserHasPassword(UserLoginDto userLoginDto) { return(UserServices.GetUserByName(userLoginDto.UserName).Password == userLoginDto.Password); }
public static void ChangePassword(UserLoginDto loginCriteria, string newPassword) { throw new System.NotImplementedException(); }