public void DepositNegativeAmountException() { OpenAccount dhurbaAccount = new OpenAccount("Dhurba", new Transaction(500.7m, "initial deposit")); //Assert.Throws check if the included Exception is thrown by the following Action. Assert.Throws <ArgumentOutOfRangeException>( () => dhurbaAccount.Deposit(new Transaction(-500.6m, "negative deposit")) ); }
public void EqualNotEmptyContainsTest() { OpenAccount dhurbaAccount = new OpenAccount("Dhurba", new Transaction(500.7m, "initial deposit salary")); dhurbaAccount.Deposit(new Transaction(1500.5m, "salary")); //Equal checks for expected outcome vs actual outcome Assert.Equal(2001.2m, dhurbaAccount.GetTotalBalance()); //NotEmpty checks if the collection is Empty or Not. Assert.Empty checks if it is empty. Assert.NotEmpty(dhurbaAccount.TransactionList); foreach (Transaction transaction in dhurbaAccount.TransactionList) { //Contains check for expected sunstring vs actual string Assert.Contains("salary", transaction.Note); } }