コード例 #1
0
        public void PlaceBid(Guid userId, uint amount)
        {
            if (userId == Guid.Empty)
            {
                throw new ArgumentNullException("userId");
            }

            uint currentPrice = GetCurrentPrice();

            if (amount <= currentPrice)
            {
                throw new ArgumentException("Amount is too low");
            }

            var bidPlacedEvent = new BidPlaced()
            {
                AuctionId = Id,
                Time = DateTime.Now,
                Amount = amount,
                UserId = userId
            };

            base.RaiseEvent(bidPlacedEvent);
        }
コード例 #2
0
        private void OnBidPlaced(BidPlaced bidPlacedEvent)
        {
            var bid = new Bid(bidPlacedEvent.UserId, bidPlacedEvent.Amount, bidPlacedEvent.Time);

            _bids.Add(bid);
        }