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(); }
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(); }
protected AbstractAccountState(StateBankAccount _account) { account = _account; }
public Closing(StateBankAccount acc) : base(acc) { }
public AccountActive(StateBankAccount acc) : base(acc) { }
public Frozen(StateBankAccount acc) : base(acc) { }
public ConfirmingIdentity(StateBankAccount acc) : base(acc) { }
public ClosingState(StateBankAccount account) : base(account) { }
public FrozenState(StateBankAccount account) : base(account) { }
public ActiveState(StateBankAccount account) : base(account) { }
public ConfirmingIdentityState(StateBankAccount account) : base(account) { }
public AbstractAccountState(StateBankAccount acc) { _account = acc; }
private static void ConfirmingIdentityTest() { StateBankAccount bankaccount = new StateBankAccount(); bankaccount.IdentityConfirmed("2345"); }