/// <summary> /// Method that creates an account with the entered information and stores it into relevant files /// </summary> public void Confirm() { TempDisplayName = AccountHandler.DisplayNameAddTag(_tempDisplayName); AccountHandler.Account = new Account(_tempUsername, TempPassword, TempDisplayName); AccountHandler.CreateAccount(AccountHandler.Account, TempProfilePicturePath); AccountList.AddAccountToFile(); SetDisplayNameForUI = AccountHandler.Account.DisplayName; }
public void CreateAccountTest() { //Arrange AccountHandler accountHandler = new AccountHandler(); //Act var account = accountHandler.CreateAccount(1, "SavingsAccount"); //Assert Assert.AreEqual(account.AccountId, 1); Assert.AreEqual(account.Type.ToString(), "SavingsAccount"); Assert.AreEqual(account.State.ToString(), "Active"); Assert.AreEqual(account.Balance, 0); }
private void buttonCreate_Click(object sender, EventArgs e) { //Create objects var customerHandler = new CustomerHandler(); var customerRepository = new CustomerRepository(); var accountHandler = new AccountHandler(); var accountRepository = new AccountRepository(); //Create a customer and save him var customer = customerHandler.CreateCustomer(textBoxFirstName.Text, textBoxLastName.Text, textBoxEmail.Text, textBoxPhone.Text); customerRepository.SaveCustomerToJson(customer); //Create a account and save it var account = accountHandler.CreateAccount(customer.CustomerId, comboBoxAccountType.Text); accountRepository.SaveAccountToJson(account); //Update this.mainForm.UpdateCustomerList(); this.Close(); }