public void NullSumCashoutTest() { var atm = new CashoutService(); var money = atm.Cashout(null); Assert.Empty(money.Banknotes); }
public void NegativeSumCashoutTest() { var atm = new CashoutService(); void act() => atm.Cashout(-130); Assert.Throws <InvalidArgumentException>(act); }
public void ImproperNotesCashoutTest() { var atm = new CashoutService(); void act() => atm.Cashout(125); Assert.Throws <NoteUnavailableException>(act); }
public void ProperNotesCashoutTest(int moneyToCashout, int[] notesExpected) { var atm = new CashoutService(); var money = atm.Cashout(moneyToCashout); var notes = money.Banknotes.Select(x => x.Value).ToArray(); var sum = money.Banknotes.Sum(x => x.Value); Assert.Equal(notesExpected, notes); Assert.Equal(moneyToCashout, sum); }
public void SetUp() { mockExceptionHandling = new Mock <IExceptionHandling>(); mockDataAccess = new Mock <IDataAccess>(); mockExceptionHandling .Setup(x => x.LogException(It.IsAny <Exception>(), ExceptionPolicy.Web_Exception)) .Verifiable(); cashoutService = new CashoutService(mockDataAccess.Object, mockExceptionHandling.Object); }