public void Debit_WhenAmountIsGreaterThanBalance_ShouldThrowArgumentOutOfRange() { //Arrange string name = "Shubham"; double availableBalance = 100; double debitAmount = 102; MangeAccount account = new MangeAccount(name, availableBalance); //Act account.Debit(debitAmount); //Act and Assert //Assert.Throws<Exception>(() => account.Debit(debitAmount)); Assert.Equal("excpetion occured.", MangeAccount.msg); }
public void Debit_LessThanZero_ThrowInvalidArgument() { //Arrange string name = "Shubham"; double availableBalance = 100; double debitAmount = -2; MangeAccount account = new MangeAccount(name, availableBalance); //Act account.Debit(debitAmount); //Assert.Throws<InvalidOperationException>(() => account.Debit(debitAmount)); //Assert Assert.Equal("excpetion occured.", MangeAccount.msg); }
public void Debit_ValidInputs_ReturnRemainingBalance() { //Arrange string name = "Shubham"; double balance = 100; double debitAmount = 55; double expectedAmount = 45; MangeAccount account = new MangeAccount(name, availableBalance: balance); //Act account.Debit(debitAmount); //Assert double availableBalance = account.GetBalance(); Assert.Equal(expectedAmount, availableBalance); }