public void Can_create_WithdrawnAmount_Event() { var id = Guid.NewGuid(); var funds = 25.000m; var @event = new WithdrawnAmount(id, funds); Assert.NotNull(@event); Assert.Equal(id, @event.AccountId); Assert.Equal(funds, @event.WithdrawnFunds); }
public void WithdrawCash(decimal cashwithdrawn, WithdrawnAmount @event) { if (_blocked) { throw new Exception("_account blocked"); } if (cashwithdrawn <= 0) { throw new ArgumentException("Amount should exceed 0"); } if ((_amount + _overdraftLimit) - cashwithdrawn < 0) { Block(new Blocked(_accountId)); Raise(@event); return; } Raise(@event); }
private void Apply(WithdrawnAmount @event) { _amount -= @event.WithdrawnFunds; }