public Price(Money amount) { if (amount == null) throw new ArgumentNullException("Amount cannot be null"); Amount = amount; }
public WinningBid RaiseMaximumBidTo(Money newAmount) { if (newAmount.IsGreaterThan(MaximumBid)) return new WinningBid(Bidder, newAmount, CurrentAuctionPrice.Amount, DateTime.Now); else throw new ApplicationException("Maximum bid increase must be larger than current maximum bid."); }
public void Bid(Guid auctionId, Guid memberId, decimal amount, DateTime dateOfBid) { var auction = _auctions.FindBy(auctionId); var bidAmount = new Money(amount); var offer = new Bid(memberId, bidAmount, dateOfBid); auction.PlaceBidFor(offer, dateOfBid); }
public Bid(Guid bidderId, Money maximumBid, DateTime timeOfOffer) { if (bidderId == Guid.Empty) throw new ArgumentNullException("BidderId cannot be null"); if (maximumBid == null) throw new ArgumentNullException("MaximumBid cannot be null"); if (timeOfOffer == DateTime.MinValue) throw new ArgumentNullException("Time of Offer must have a value"); Bidder = bidderId; MaximumBid = maximumBid; TimeOfOffer = timeOfOffer; }
public WinningBid(Guid bidder, Money maximumBid, Money bid, DateTime timeOfBid) { if (bidder == Guid.Empty) throw new ArgumentNullException("Bidder cannot be null"); if (maximumBid == null) throw new ArgumentNullException("MaximumBid cannot be null"); if (timeOfBid == DateTime.MinValue) throw new ArgumentNullException("TimeOfBid must have a value"); Bidder = bidder; MaximumBid = maximumBid; TimeOfBid = timeOfBid; CurrentAuctionPrice = new Price(bid); }
public Auction(Guid id, Guid listingId, Money startingPrice, DateTime endsAt) { if (id == Guid.Empty) throw new ArgumentNullException("Auction Id cannot be null"); if (startingPrice == null) throw new ArgumentNullException("Starting Price cannot be null"); if (endsAt == DateTime.MinValue) throw new ArgumentNullException("EndsAt must have a value"); if (listingId == Guid.Empty) throw new ArgumentNullException("Lisitng Id cannot be null"); Id = id; ListingId = listingId; StartingPrice = startingPrice; EndsAt = endsAt; }
public bool CanBeExceededBy(Money offer) { return offer.IsGreaterThanOrEqualTo(BidIncrement()); }
public bool IsLessThanOrEqualTo(Money money) { return this.Value < money.Value || this.Equals(money); }
public bool IsGreaterThanOrEqualTo(Money money) { return this.Value > money.Value || this.Equals(money); }
public bool IsGreaterThan(Money money) { return this.Value > money.Value; }
public Money Add(Money money) { return new Money(Value + money.Value); }
public bool CanMeetOrExceedBidIncrement(Money offer) { return CurrentAuctionPrice.CanBeExceededBy(offer); }
private bool MaxBidCanBeExceededBy(Money bid) { return !this.MaximumBid.IsGreaterThanOrEqualTo(bid); }
private WinningBid CreateNewBid(Guid bidder, Money bid, Money maxBid, DateTime timeOfBid) { return new WinningBid(bidder, bid, maxBid, timeOfBid); }
public HistoricalBid(Guid bidder, Money Bid, DateTime timeOfBid) { }