public void LogOnTest() { UserBusiness target = new UserBusiness(); // TODO: Initialize to an appropriate value string username = string.Empty; // TODO: Initialize to an appropriate value string password = string.Empty; // TODO: Initialize to an appropriate value SessionInfo expected = null; // TODO: Initialize to an appropriate value SessionInfo actual; actual = target.LogOn(username, password); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
//public static SessionInfo LogOn(string username) //{ // SessionInfo _session = new SessionInfo(); // if (username.ToUpper().Equals("ADMINISTRATOR")) // { // UserBusiness _userBusiness = new UserBusiness(); // _session = _userBusiness.LogOn(username); // } // return _session; //} public static SessionInfo LogOn(string username, string password, string userIP, int intADLogin) { UserBusiness _userBusiness = new UserBusiness(); SessionInfo _session = null; //string currentpassword = DecodeJSPassEncoding(password); string currentpassword = password.Trim(); try { if (username.ToUpper().Equals("ADMINISTRATOR")) { string systempassword = DecodeJSPassEncoding((string)ConfigurationSettings.AppSettings[AppSettingName.SYSTEM_KEY]); if (systempassword.Equals(currentpassword)) _session = _userBusiness.LogOn(username, userIP); else throw new Exception("That password is incorrect. Be sure you're using the password for your Deal Maker account."); _session.IsSystemUser = true; } else { //log on via AD user bool validUser = false; if (intADLogin == 1) validUser = LDAPHelper.ValidateUser(username, currentpassword); else validUser = _userBusiness.GetAll().FirstOrDefault(p => p.USERCODE.ToLower().Equals(username.ToLower())) != null ? true : false; if (validUser) { _session = _userBusiness.LogOn(username, userIP); _session.IsSystemUser = false; } else throw new Exception("That username is not authorized. Be sure you're using the username and password for your Windows account."); } } catch (Exception ex) { throw new UIPException(ex); } return _session; }