private void Register(object sender, RoutedEventArgs e) { switch (_clientModel.CheckDetails()) { case Client.DetailsMatched: _clientModel.UserPassword = txtPassword.Password; _clientHandler.Register(_clientModel); break; case Client.DetailsUnmatched: LabelErrorMessageAnimator("Both details fail to meet the requirements.", lblErrorMessage); break; case Client.UsernameUnmatched: LabelErrorMessageAnimator("Username doesn't meet necessary requirements.", lblErrorMessage); break; case Client.PasswordUnmatched: LabelErrorMessageAnimator("Password doesn't meet necessary requirements.", lblErrorMessage); break; } }
public void Multiple_Register_Attempts() { Server s = new Server(); ThreadPool.QueueUserWorkItem(s.ImServer.StartServer, null); s.ImServer.CurrentClients._imUsers.Clear(); s.ImServer.CurrentClients.SaveDictionaryToFile(); Thread.Sleep(20); int reg = 0; while (s.ImServer.ServerActive && reg != 6) { var clientAuth1 = new ImClientHandler( s.ImServer.IpAddress.ToString(), s.ImServer.PortAddress); clientAuth1.Register(_clients[reg]); Thread.Sleep(400); reg++; } Assert.IsTrue(s.ImServer.CurrentClients._imUsers.Count == 6); s.ImServer.StopServer(); }