public AtmViewModel(Atm atm) { _atm = atm; _repository = new AtmRepository(); _paymentGateway = new PaymentGateway(); TakeMoneyCommand = new Command<decimal>(x => x > 0, TakeMoney); }
public void Take_money_exchanges_money_with_commission() { var atm = new Atm(); atm.LoadMoney(Money.Dollar); atm.TakeMoney(1m); atm.MoneyCharged.Should().Be(1.01m); }
public void Commission_is_rounded_up_to_the_next_cent() { var atm = new Atm(); atm.LoadMoney(Money.Dollar + Money.TenCent); atm.TakeMoney(1.1m); atm.MoneyCharged.Should().Be(1.12m); }
public void Commission_is_at_least_one_cent() { var atm = new Atm(); atm.LoadMoney(Money.Cent); atm.TakeMoney(0.01m); atm.MoneyCharged.Should().Be(0.02m); }
public void Take_money_raises_an_event() { Atm atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); atm.ShouldContainBalanceChangedEvent(1.01m); }
public AtmViewModel(Atm atm, IAtmRepository repository, EventDispatcher eventDispatcher) { _atm = atm; _repository = repository; _eventDispatcher = eventDispatcher; _paymentGateway = new PaymentGateway(); TakeMoneyCommand = new Command<decimal>(x => x > 0, TakeMoney); }
public void Take_money_raises_an_event() { Initer.Init(@"Server=.\SQLEXPRESS;Database=DddInPractice;Trusted_Connection=true"); Atm atm = new Atm(); atm.LoadMoney(Money.Dollar); atm.TakeMoney(1m); atm.ShouldContainBalanceChangedEvent(1.01m); }
private static void SetupAtm(IAtmRepository atmRepository) { var atm = new Atm() {Id = 1}; atm.LoadMoney(new Money(20,20,20,20,20,20)); atmRepository.Save(atm); }
public virtual void LoadCashToAtm(Atm atm) { atm.LoadMoney(Cash); Cash = Money.None; }