public void Commission_is_rounded_up_to_the_next_cent() { var atm = new Atm(); atm.LoadMoney(OneDollar + TenCent); atm.TakeMoney(1.1m); atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(1.12m); }
public void Take_money_exchanges_with_commission() { var atm = new Atm(); atm.LoadMoney(OneDollar); atm.TakeMoney(1m); atm.MoneyInside.Amount.Should().Be(0m); 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_should_be_at_least_one_cent() { var atm = new Atm(); atm.LoadMoney(Cent); atm.TakeMoney(0.01m); atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(0.02m); }
public void CommissionIsAtLeastOneCent() { var atm = new Atm(); atm.LoadMoney(Cent); atm.TakeMoney(0.01m); atm.MoneyCharged.Should().Be(0.02m); }
public void CommissionIsRoundedUpToNextCent() { var atm = new Atm(); atm.LoadMoney(Dollar + TenCent); atm.TakeMoney(1.1m); atm.MoneyCharged.Should().Be(1.12m); }
public void Comission_is_at_least_one_cent() { var atm = new Atm(); atm.LoadMoney(Cent); atm.TakeMoney(Cent.Amount); Assert.AreEqual(atm.MoneyCharged, 0.02m); }
public void Comission_is_at_least_one_cent() { var atm = new Atm(); atm.LoadMoney(Cent); atm.TakeMoney(0.01m); atm.MoneyCharged.Should().Be(0.02m); }
public void TakeMoney_ShouldRoundedUpCommissionToTheNextCent() { var atm = new Atm(); atm.LoadMoney(OneDollar + TenCent); atm.TakeMoney(1.1m); atm.MoneyCharged.Should().Be(1.12m); }
public void TakeMoney_ShouldApplyCommissionWithAtLeastOneCent() { var atm = new Atm(); atm.LoadMoney(OneCent); atm.TakeMoney(0.01m); atm.MoneyCharged.Should().Be(0.02m); }
public void take_money_raises_an_event() { var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); atm.ShouldContainBalanceChangedEvent(1.01m); }
public void TakeMoney_ShouldExchangesMoneyWithCommission() { var atm = new Atm(); atm.LoadMoney(OneDollar); atm.TakeMoney(1); atm.MoneyInside.Should().Be(None); atm.MoneyCharged.Should().Be(1.01m); }
public void TakeMoneyExchangesMoneyWIthCommission() { var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(1.01m); }
public void Comission_is_rounded_up_to_next_cent() { var atm = new Atm(); var DollarAndCent = Dollar + TenCent; atm.LoadMoney(DollarAndCent); atm.TakeMoney(DollarAndCent.Amount); Assert.AreEqual(atm.MoneyCharged, 1.12m); }
public void Take_money_raises_an_event() { Initer.Init(@"Data Source=.\dev;Initial Catalog=SnackMachineDb;Integrated Security=SSPI;"); var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); atm.ShouldContainBalanceChangeEvents(1.01m); }
public void Take_money_exchanges_money_with_comission() { var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(Dollar.Amount); Assert.AreEqual(atm.MoneyInside.Amount, 0); Assert.AreEqual(atm.MoneyCharged, 1.01m); }
public void Take_money_raises_an_event() { var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); var balanceChangedEvent = (BalanceChangedEvent)atm.DomainEvents.SingleOrDefault(x => x.GetType() == typeof(BalanceChangedEvent)); balanceChangedEvent.Should().NotBeNull(); balanceChangedEvent?.Delta.Should().Be(1.01m); }
public void TakeMoney_ShouldRaiseAnEvent() { var atm = new Atm(); atm.LoadMoney(OneDollar); atm.TakeMoney(1); var balanceChangedEvent = atm.DomainEvents.First() as BalanceChangedEvent; balanceChangedEvent.Should().NotBeNull(); balanceChangedEvent.Delta.Should().Be(1.01m); }
public void Take_money_raise_an_event() { var atm = new Atm(); atm.LoadMoney(Dollar); atm.TakeMoney(1m); var balanceChangedEvent = atm.DomainEvents[0] as BalanceChangedEvent; Assert.IsNotNull(balanceChangedEvent); Assert.AreEqual(balanceChangedEvent.Delta, 1.01m); }
public void Take_Money_raises_an_event() { var atm = new Atm(); atm.LoadMoney(Money.Dollar); atm.TakeMoney(1m); var balanceChangedEvent = atm.DomainEvents[0] as BalanceChangedEvent; balanceChangedEvent.Should().NotBeNull(); balanceChangedEvent.Delta.Should().Be(1.01m); }
public void Withrawl_Cannot_if_not_enough_change_in_Atm() { //Arranage Atm atm = new Atm(); atm.LoadMoney(Dollar); //Act atm.Withdrawal(2m); //Assert true.Should().Equals(atm.AnyErrors()); Constants.NotEnoughChange.Should().Equals(atm.Project()); }
public void Withrawl_Charge_Happens() { //Arranage Atm atm = new Atm(); atm.LoadMoney(Dollar); //Act atm.Withdrawal(1m); //Assert atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(1.01m); }
public void Withrawl_Charge_IsAtLeast_OneCent() { //Arranage var atm = new Atm(); atm.LoadMoney(Cent); //Act atm.Withdraw(Cent.Amount); //Assert atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(.02m); }
public void Commission_is_at_least_one_cent() { Initer.Init("Server=(localdb)\\mssqllocaldb;Database=DddInPractice;Trusted_Connection=True;"); BalanceChangedEvent balanceChangedEvent = null; DomainEvents_old.Register <BalanceChangedEvent>(ev => balanceChangedEvent = ev); var atm = new Atm(); atm.LoadMoney(Cent); atm.TakeMoney(0.01m); atm.MoneyCharged.Should().Be(0.02m); }
public void Commission_is_rounded_up_to_the_next_cent() { Initer.Init("Server=(localdb)\\mssqllocaldb;Database=DddInPractice;Trusted_Connection=True;"); BalanceChangedEvent balanceChangedEvent = null; DomainEvents_old.Register <BalanceChangedEvent>(ev => balanceChangedEvent = ev); var atm = new Atm(); atm.LoadMoney(Dollar + TenCent); atm.TakeMoney(1.1m); atm.MoneyCharged.Should().Be(1.12m); }
public void Withrawl_Charge_IsAtLeast_OneCent2() { //Arranage var atm = new Atm(); atm.LoadMoney(Dollar + TenCent); //Act atm.Withdrawal(1.1m); //Assert atm.MoneyInside.Amount.Should().Be(0m); atm.MoneyCharged.Should().Be(1.12m); }
public void Take_money_raises_an_event() { Initer.Init("Server=(localdb)\\mssqllocaldb;Database=DddInPractice;Trusted_Connection=True;"); Atm atm = new Atm(); atm.LoadMoney(Dollar); BalanceChangedEvent balanceChangedEvent = null; DomainEvents_old.Register <BalanceChangedEvent>(ev => balanceChangedEvent = ev); atm.TakeMoney(1m); balanceChangedEvent.Should().NotBeNull(); balanceChangedEvent.Delta.Should().Be(1.01m); }
public void Take_money_raises_an_event() { Initer.Init(@"Server=(localdb)\MSSqlLocalDB;Database=DDDInPractice;Trusted_Connection=true"); var atm = new Atm(); atm.LoadMoney(Money.Dollar); atm.TakeMoney(1m); var balanceChangedEvent = atm.DomainEvents[0] as BalanceChangedEvent; balanceChangedEvent.Should().NotBeNull(); balanceChangedEvent.Delta.Should().Be(1.01m); }
public void Withrawl_raises_an_event() { //Arranage var atm = new Atm(); atm.LoadMoney(Dollar); //Act atm.Withdrawal(1m); //Assert var @event = atm.DomainEvents[0] as BalanceChangedEvent; @event.Should().NotBeNull(); @event.Delta.Should().Be(1.01m); }
public void Take_money_raise_an_event() { SessionFactory.Init(@"Server=.;Database=SnackMachineDDD;Trusted_Connection=True;"); DomainEvents.Init(); Atm atm = new Atm(); atm.LoadMoney(OneDollar); //BalanceChangedEvent balanceChangedEvent = null; //DomainEvents.Register<BalanceChangedEvent>(ev => balanceChangedEvent = ev); atm.TakeMoney(1m); //Check event var balanceChangedEvent = atm.DomainEvents[0] as BalanceChangedEvent; //balanceChangedEvent.Should().NotBeNull(); //balanceChangedEvent.Delta.Should().Be(1.01m); atm.ShouldContainsBalanceChangedEvent(1.01m); }