예제 #1
0
 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);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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";
                }
            }
        }