Exemple #1
0
        public void SystemAddBalanceTest()
        {
            system.AddAccount("098960505");
            system.AddAmmountToBalance("098960505", "100");
            Account account = unitOfWork.Accounts.FindAccountByCellPhoneNumber("098960505");

            Assert.IsTrue(account.AccountBalance == 100);
        }
        private void AddBalanceBtn_Click(object sender, EventArgs e)
        {
            Notification status;
            string       userPhoneNumber = this.userAccountTxtBox.Text;

            userPhoneNumber = parkingSystem.FormatPhoneNumber(userPhoneNumber);
            string balanceToAdd = this.userBalanceTxtBox.Text;

            status = parkingSystem.ValidatePhoneNumber(userPhoneNumber);
            status.AppendNotificationMessages(parkingSystem.ValidateExistingAccountForAccountTransaction(userPhoneNumber));

            if (!status.HasErrors())
            {
                status.AppendNotificationMessages(parkingSystem.AddAmmountToBalance(userPhoneNumber, balanceToAdd));
            }
            this.outputErrorLbl.Text      = status.HasErrors()?$"Error: { status.Message()}":status.Message();
            this.outputErrorLbl.ForeColor = status.HasErrors()?Color.Red: Color.Green;
        }