Exemplo n.º 1
0
        private void ValidateDates(AuctionDate startDate, AuctionDate endDate, bool compareToNow)
        {
            bool startLessThanOffset = false;

            if (compareToNow)
            {
                startLessThanOffset = (DateTime.UtcNow.Subtract(startDate).TotalMinutes > MAX_TODAY_MIN_OFFSET);
            }

            if (startLessThanOffset)
            {
                throw new DomainException("");
            }

            bool hasMinTime = (endDate.Value.Subtract(startDate)).TotalMinutes >= MIN_AUCTION_TIME_M;

            if (!hasMinTime)
            {
                throw new DomainException("");
            }
            bool startLessThanEnd = startDate.Value.CompareTo(endDate) == -1;

            if (!startLessThanEnd)
            {
                throw new DomainException("Invalid auction date");
            }
        }
Exemplo n.º 2
0
 public void UpdateEndDate(AuctionDate newEndDate)
 {
     ThrowIfCompletedOrCanceled();
     ValidateDates(StartDate, newEndDate, false);
     if (newEndDate.Value.CompareTo(EndDate.Value) == 0)
     {
         return;
     }
     //TODO
     EndDate = newEndDate;
     AddUpdateEvent(new AuctionEndDateChanged(AggregateId, newEndDate));
 }
Exemplo n.º 3
0
 public Builder SetEndDate(AuctionDate endDate)
 {
     args.EndDate = endDate;
     return(this);
 }
Exemplo n.º 4
0
 public Builder SetStartDate(AuctionDate startDate)
 {
     args.StartDate = startDate;
     return(this);
 }