Example #1
0
        public Price(Money amount)
        {
            if (amount == null)
                throw new ArgumentNullException("Amount cannot be null");

            Amount = amount;
        }
Example #2
0
 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.");
 }
Example #3
0
        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);                                
         }                      
Example #4
0
        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;
        }
Example #5
0
        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);
        }
Example #6
0
    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;            
    }
Example #7
0
 public bool CanBeExceededBy(Money offer)
 {
     return offer.IsGreaterThanOrEqualTo(BidIncrement());
 }
Example #8
0
 public bool IsLessThanOrEqualTo(Money money)
 {
     return this.Value < money.Value || this.Equals(money);
 }
Example #9
0
 public bool IsGreaterThanOrEqualTo(Money money)
 {
     return this.Value > money.Value || this.Equals(money);
 }
Example #10
0
 public bool IsGreaterThan(Money money)
 {
     return this.Value > money.Value;
 }
Example #11
0
 public Money Add(Money money)
 {
     return new Money(Value + money.Value);
 }
Example #12
0
 public bool CanMeetOrExceedBidIncrement(Money offer)
 {
     return CurrentAuctionPrice.CanBeExceededBy(offer);
 }
Example #13
0
 private bool MaxBidCanBeExceededBy(Money bid)
 {
     return !this.MaximumBid.IsGreaterThanOrEqualTo(bid);
 }
Example #14
0
 private WinningBid CreateNewBid(Guid bidder, Money bid, Money maxBid, DateTime timeOfBid)
 {          
     return new WinningBid(bidder, bid, maxBid, timeOfBid);
 }
Example #15
0
 public HistoricalBid(Guid bidder, Money Bid, DateTime timeOfBid)
 { 
 
 }