Exemplo n.º 1
0
        public void WhenANewCustomerIsAdded_TheNumberOfCustemersIncreasesBy1()
        {
            using (var db = new Gam3Sp0tContext())
            {
                var numberOfUsersBefore = db.Users.Count();
                _operations.CreateUser("FRY", "Phillip", "Fry", "testPass", false);
                var numberOfUsersAfter = db.Users.Count();

                Assert.AreEqual(numberOfUsersBefore + 1, numberOfUsersAfter);
            }
        }
        private void BtnSignUp_Click(object sender, RoutedEventArgs e)
        {
            bool createAdmin = false;

            if (rbAdmin.IsChecked is true)
            {
                createAdmin = true;
            }

            if (txtPassword.Password == txtRePass.Password)
            {
                if ((txtFName.Text != "") && (txtLName.Text != "") && (txtUsername.Text != "") && (txtPassword.Password != ""))
                {
                    _userCRUD.CreateUser(txtUsername.Text, txtFName.Text, txtLName.Text, txtPassword.Password, createAdmin);

                    MessageBoxResult result = MessageBox.Show("Account Created!",
                                                              "Confirmation",
                                                              MessageBoxButton.OK);
                    if (result == MessageBoxResult.OK)
                    {
                        //Go to login screen
                        RegisterWindow regWindow = this;
                        regWindow.Close();
                    }
                }
            }
        }