示例#1
0
        private static void OtherTestStates()
        {
            StateBankAccount bankaccount = new StateBankAccount();
            bankaccount.IdentityConfirmed("1234");
            bankaccount.Credit(1000);
            bankaccount.Credit(1000);
            bankaccount.Debit(1000);
            bankaccount.Freeze();

            //Note: For each test below, uncomment a test and check your results. Then
            //comment out that test and move to the next test.

            //Test #1: Invalid state for debit should throw an exception
            bankaccount.Debit(1000);

            bankaccount.Unfreeze();

            //Test #2: Account closes properly with zero balance
            bankaccount.Debit(1000);

            // Test #3 : Overdraws account account can't be closed
            //bankaccount.Debit(2500);

            //Initial run, balance not zero, cuts a check and closes account
            bankaccount.Close();

            //Test #4 : Leave Test #3 uncommented. Credits 1500 and can now close the account
            //bankaccount.Credit(1500);
            //bankaccount.Close();
        }
示例#2
0
 private static void PassTestStates()
 {
     StateBankAccount bankaccount = new StateBankAccount();
     bankaccount.IdentityConfirmed("1234");
     bankaccount.Credit(1000);
     bankaccount.Credit(1000);
     bankaccount.Credit(1000);
     bankaccount.Freeze();
     bankaccount.Unfreeze();
     bankaccount.Debit(3000);
     bankaccount.Close();
 }
示例#3
0
 protected AbstractAccountState(StateBankAccount _account)
 {
     account = _account;
 }
示例#4
0
 public Closing(StateBankAccount acc)
     : base(acc)
 {
 }
示例#5
0
 public AccountActive(StateBankAccount acc)
     : base(acc)
 {
 }
示例#6
0
 public Frozen(StateBankAccount acc)
     : base(acc)
 {
 }
示例#7
0
 public ConfirmingIdentity(StateBankAccount acc)
     : base(acc)
 {
 }
示例#8
0
 public ClosingState(StateBankAccount account) : base(account)
 {
 }
示例#9
0
 public FrozenState(StateBankAccount account) : base(account)
 {
 }
示例#10
0
 public ActiveState(StateBankAccount account) : base(account)
 {
 }
示例#11
0
 public ConfirmingIdentityState(StateBankAccount account) : base(account)
 {
 }
 public AbstractAccountState(StateBankAccount acc)
 {
     _account = acc;
 }
示例#13
0
 private static void ConfirmingIdentityTest()
 {
     StateBankAccount bankaccount = new StateBankAccount();
     bankaccount.IdentityConfirmed("2345");
 }