public LoginResult LoginByBadgeCode(string workerBadgeCode, string stationName) { try { Result = Auth.Login(string.Empty, string.Empty, workerBadgeCode, stationName); if (!(string.IsNullOrEmpty(Auth.ExceptionMessage))) { throw new Exception(string.Format("Authenticator exception: {0}", Auth.ExceptionMessage)); } } catch (Exception ex) { throw new Exception(string.Format("{0}{1}{2}", ex.Message, Environment.NewLine, Auth.ExceptionMessage)); } return(GetLoginResult(Result)); }
public void TestLocalUserPassword() { bool actual = false; bool expected = true; string workerLoginName = "Administrator"; string workerPassword = "******"; string stationName = "ST10"; WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.UserPassword); WorkerLoginResult res = wa.Login(workerLoginName, workerPassword, string.Empty, stationName); if (res == WorkerLoginResult.Ok) { actual = true; } Assert.AreEqual(expected, actual); }
public void TestLocalBadgeCode() { bool actual = false; bool expected = true; string workerLoginName = "Administrator"; string workerBadgeCode = "12345"; string stationName = "ST10"; WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.BadgeCode); WorkerLoginResult res = wa.Login(string.Empty, string.Empty, workerBadgeCode, stationName); if (wa.CurrentWorker.LoginName == workerLoginName && res == WorkerLoginResult.Ok) { actual = true; } Assert.AreEqual(expected, actual); }
public void TestRemoteBadgeCode() { bool actual = false; bool expected = true; string workerLoginName = "marco.dallera"; string workerBadgeCode = ";80380000100118208054?"; string stationName = "ST60.00"; string connectionString = "Data Source=192.168.100.250;Initial Catalog=TraMa4_520-334;User ID=TraMa;Password=trama"; WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.BadgeCode, connectionString); WorkerLoginResult res = wa.Login(string.Empty, string.Empty, workerBadgeCode, stationName); if (wa.CurrentWorker.LoginName == workerLoginName && res == WorkerLoginResult.Ok) { actual = true; } Assert.AreEqual(expected, actual); }
public void TestRemoteUserPassword() { bool actual = false; bool expected = true; string workerLoginName = "marco.dallera"; string workerPassword = "******"; string stationName = "ST60.00"; string connectionString = "Data Source=192.168.100.250;Initial Catalog=TraMa4_520-334;User ID=TraMa;Password=trama"; WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.UserPassword, connectionString); WorkerLoginResult res = wa.Login(workerLoginName, workerPassword, string.Empty, stationName); if (res == WorkerLoginResult.Ok) { actual = true; } Assert.AreEqual(expected, actual); }
public void TestLocalBadgeCodeKo() { bool actual = false; bool expected = true; string workerLoginName = string.Empty; string workerBadgeCode = "12345"; string stationName = "ST99C"; Init_PB139(); WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.BadgeCode); WorkerLoginResult res = wa.Login(string.Empty, string.Empty, workerBadgeCode, stationName); if (wa.CurrentWorker.LoginName == workerLoginName && res == WorkerLoginResult.Failed) { actual = true; } Assert.AreEqual(expected, actual); }
public void TestLocalUserPasswordKo() { bool actual = false; bool expected = true; string workerLoginName = "FakeUser"; string workerPassword = "******"; string stationName = "ST104F"; Init_PB139(); WorkerAuthenticator wa = new WorkerAuthenticator(AuthenticationMode.UserPassword); WorkerLoginResult res = wa.Login(workerLoginName, workerPassword, string.Empty, stationName); if (res == WorkerLoginResult.Failed) { actual = true; } Assert.AreEqual(expected, actual); }