コード例 #1
0
ファイル: EventsTests.cs プロジェクト: Smiley95/LDStraining
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 private void Apply(WithdrawnAmount @event)
 {
     _amount -= @event.WithdrawnFunds;
 }