public void WhenCorrectLoginDetailsAreEntered_SelectedIsSetToTrue() { using (var db = new GameMarketContext()) { userMethods.Create("unitTest", "unitTestUsername", "*****@*****.**", "unitTest"); decimal loginUserID = login.emailCheck("*****@*****.**", "unitTest"); var selectedUser = db.Users.Where(u => u.Selected == true).FirstOrDefault(); Assert.AreNotEqual(loginUserID, 0); Assert.AreEqual("unitTestUsername", selectedUser.Username); } }
public void WhenANewUserIsAdded_TheNumberOfUsersIncreasesBy1() { using (var db = new GameMarketContext()) { var numberOfUsersBefore = db.Users.Count(); _crudMethods.Create("Sam Pickard", "Beausy", "*****@*****.**", "test123"); var numberOfUsersAfter = db.Users.Count(); Assert.AreEqual(numberOfUsersBefore + 1, numberOfUsersAfter); } }
private void Btn_Click(object sender, RoutedEventArgs e) { Button clickBtn = (Button)sender; if (clickBtn.Name == "loginPageBtn") { MainWindow mainWindow = new MainWindow(); App.Current.MainWindow = mainWindow; this.Close(); mainWindow.Show(); } else if (clickBtn.Name == "signUpBtn") { if (_crudMethods.Create(nameText.Text, usernameTxt.Text, emailTxt.Text, passwordText.Password)) { responseTxt.Text = "Account Created Successfully!"; } else { responseTxt.Text = "Username or Email already in use"; } } }