private List <string> GetWithdrawOutput(string command) { var amount = 0; List <string> commandResult = new List <string>(); if (int.TryParse(command, out amount)) { if (amount == 0) { commandResult.Add($"Cannot withdraw {amount}"); return(commandResult); } if (_atmService.Withdraw(amount)) { commandResult.Add($"Success: Dispensed ${amount}"); commandResult.AddRange(_atmService.BuildBalanceOutput()); } else { commandResult.Add("Failure: Insufficient funds"); } } else { commandResult.Add("Failure: Invalid Command"); } return(commandResult); }
public void Withdraw_Failure_Insufficient(int amount) { var atmService = new AtmService(); Assert.True(atmService.Withdraw(amount)); }
public void Withdraw_Success(int amount) { var atmService = new AtmService(); Assert.True(atmService.Withdraw(amount)); }