public void WithdrawChecking() { //$100 - $75 CheckingAccount example = new CheckingAccount(); example.Deposit(new DollarAmount(10000)); example.Withdraw(new DollarAmount(7500)); DollarAmount expected = new DollarAmount(2500); Assert.AreEqual(expected.ToString(), example.Balance.ToString()); //$100 - $110 CheckingAccount example1 = new CheckingAccount(); example1.Deposit(new DollarAmount(10000)); example1.Withdraw(new DollarAmount(11000)); DollarAmount expected1 = new DollarAmount(-2000); Assert.AreEqual(expected1.ToString(), example1.Balance.ToString()); //$100 - $500 CheckingAccount example2 = new CheckingAccount(); example2.Deposit(new DollarAmount(10000)); example2.Withdraw(new DollarAmount(50000)); DollarAmount expected2 = new DollarAmount(10000); Assert.AreEqual(expected2.ToString(), example2.Balance.ToString()); }
public void WithdrawSavings() { //$100 - $50 SavingsAccount example = new SavingsAccount(); example.Deposit(new DollarAmount(10000)); example.Withdraw(new DollarAmount(5000)); DollarAmount expected = new DollarAmount(4800); Assert.AreEqual(expected.ToString(), example.Balance.ToString()); //$300 - $50 SavingsAccount example1 = new SavingsAccount(); example1.Deposit(new DollarAmount(30000)); example1.Withdraw(new DollarAmount(5000)); DollarAmount expected1 = new DollarAmount(25000); Assert.AreEqual(expected1.ToString(), example1.Balance.ToString()); //$100 - $150 SavingsAccount example2 = new SavingsAccount(); example2.Deposit(new DollarAmount(10000)); example2.Withdraw(new DollarAmount(15000)); DollarAmount expected2 = new DollarAmount(10000); Assert.AreEqual(expected2.ToString(), example2.Balance.ToString()); }
public void ToStringTest() { DollarAmount thisTest = new DollarAmount(90, 50); string results = thisTest.ToString(); Assert.AreEqual("$90.50", results); }
public void DollarAmountToStringTest() { DollarAmount thisDollarAmount = new DollarAmount(1140); string result = thisDollarAmount.ToString(); Assert.AreEqual("$11.40", result); }
public void DollarAmount_ToStringTest() { string expected = "$32.10"; DollarAmount testedInstance = new DollarAmount(32, 10); Assert.AreEqual(expected, testedInstance.ToString()); expected = "$-32.10"; DollarAmount negativeTestedInstance = new DollarAmount(-32, -10); Assert.AreEqual(expected, negativeTestedInstance.ToString()); }
public void ToString() { DollarAmount exercise = new DollarAmount(3210); Assert.AreEqual("$32.10", exercise.ToString()); exercise = new DollarAmount(1000); Assert.AreEqual("$10.00", exercise.ToString()); exercise = new DollarAmount(1); Assert.AreEqual("$0.01", exercise.ToString()); }
public void ToStringTest() { DollarAmount test = new DollarAmount(3210); Assert.AreEqual("$32.10", test.ToString()); DollarAmount test2 = new DollarAmount(1000); Assert.AreEqual("$10.00", test2.ToString()); DollarAmount test3 = new DollarAmount(1); Assert.AreEqual("$0.01", test3.ToString()); }
public void BankAccount_TransferTests() { BankAccount dist = new BankAccount(); BankAccount source = new BankAccount(); dist.Deposit(new DollarAmount(40, 00)); source.Deposit(new DollarAmount(30, 00)); source.Transfer(dist, new DollarAmount(10, 00)); DollarAmount testedInstanceExpected = new DollarAmount(20, 00); Assert.AreEqual(testedInstanceExpected.ToString(), source.Balance.ToString()); Assert.AreEqual("$60.00", dist.Balance.ToString()); }
public void Withdraw() { BankAccount account1 = new BankAccount(); DollarAmount initialBalance = new DollarAmount(10000); DollarAmount withdrawnBalance = new DollarAmount(5000); account1.Deposit(initialBalance); account1.Withdraw(withdrawnBalance); DollarAmount expected = withdrawnBalance; Assert.AreEqual(expected.ToString(), account1.Balance.ToString()); }
public void Deposit() { BankAccount account1 = new BankAccount(); DollarAmount initialBalance = new DollarAmount(10000); account1.Deposit(initialBalance); BankAccount account2 = new BankAccount(); DollarAmount initialBalance2 = new DollarAmount(10000); account2.Deposit(initialBalance2); Assert.AreEqual(initialBalance.ToString(), account1.Balance.ToString()); }
public new void ToString() { DollarAmount jimmyDollar = new DollarAmount(3210); Assert.AreEqual("$32.10", jimmyDollar.ToString()); DollarAmount bobbyDollar = new DollarAmount(1000); Assert.AreEqual("$10.00", bobbyDollar.ToString()); DollarAmount dollyDollar = new DollarAmount(1); Assert.AreEqual("$0.01", dollyDollar.ToString()); DollarAmount ellaDollar = new DollarAmount(-1000); Assert.AreEqual("$-10.00", ellaDollar.ToString()); }
public void Transfer() { BankAccount b1 = new BankAccount(); BankAccount b2 = new BankAccount(); DollarAmount amountToDeposit = new DollarAmount(100); DollarAmount newBalance = b2.Deposit(amountToDeposit); DollarAmount amountToTransfer = new DollarAmount(50); b2.Transfer(b1, amountToTransfer); DollarAmount b1Expected = new DollarAmount(50); DollarAmount b2Expected = new DollarAmount(50); Assert.AreEqual(b2Expected.ToString(), b2.Balance.ToString()); Assert.AreEqual(b1Expected.ToString(), b1.Balance.ToString()); }
public void CheckToMakeSureOneDigitCentWorksProperly() { DollarAmount x = new DollarAmount(1); Assert.AreEqual("$0.01", x.ToString()); }
public void CheckToSeeIfOnlyDollarComesUp() { DollarAmount x = new DollarAmount(300); Assert.AreEqual("$3.00", x.ToString()); }
public void CheckToSeeIfOnlyCentsComeUp() { DollarAmount x = new DollarAmount(25); Assert.AreEqual("$0.25", x.ToString()); }
public void CheckToSeeIfBothTheDollarAndCentsCome() { DollarAmount x = new DollarAmount(250); Assert.AreEqual("$2.50", x.ToString()); }