public void LogInToExistingAccount_UserWithSpecifiedNameIsNotRegistered_LoginFails() { //Arrange var login = new Login(); var randomStringGenerator = new RandomStringGenerator(); var formLogin = new FormLogin(); var database = new DataClassesBettingParlorDataContext(); var username = randomStringGenerator.GenerateRandomString(); var password = randomStringGenerator.GenerateRandomString(); //Action formLogin.textBoxUsername.Text = username; formLogin.textBoxPassword.Text = password; //Log in to account which not exists. var loginResult = login.LogInToExistingAccount(username, password, formLogin); //Assert Assert.IsFalse(loginResult); }
/// <summary> /// Creates temporary client in dataBase. /// </summary> /// <remarks> Used whenever client storted in database is needed.</remarks> protected bool CreateUserinDatabase() { //Arrange var login = new Login(); var randomStringGenerator = new RandomStringGenerator(); formLogin = new FormLogin(); var database = new DataClassesBettingParlorDataContext(); username = randomStringGenerator.GenerateRandomString(); password = randomStringGenerator.GenerateRandomString(); connectionId = randomStringGenerator.GenerateRandomString(); //Fill textBoxes on form to pass checkIfTextBoxesAreEmpty verification. formLogin.textBoxUsername.Text = username; formLogin.textBoxPassword.Text = password; //true if client is able to register, false if not. return(login.RegisterNewPlayer(username, password, formLogin)); }
public void AddCLientToList_ClientIsAlreadyInDictionary_ClientIsNotAddedReturnFalse() { //Arrange CreateUserinDatabase(); var loadUserData = new LoadUserData(); var randomStringGenerator = new RandomStringGenerator(); var fakeConnectionId = randomStringGenerator.GenerateRandomString(); //Add recently created user to dictionary. loadUserData.AddClientToList(connectionId, username); //Try to add user with same username. var result = loadUserData.AddClientToList(fakeConnectionId, username); //Assert Assert.IsFalse(result); //Delete recently added player in database to avoid conflicts with further tests. DeleteUserFromDatabase(username); }