예제 #1
0
        internal PurchasedMovie(Movie movie, Customer customer, Dollars price, ExpirationDate expirationDate)
        {
            if (price == null || price.IsZero)
            {
                throw new ArgumentException(nameof(price));
            }

            if (expirationDate == null || expirationDate.IsExpired)
            {
                throw new ArgumentException(nameof(expirationDate));
            }

            Price          = price;
            Movie          = movie ?? throw new ArgumentNullException(nameof(movie));
            Customer       = customer ?? throw new ArgumentNullException(nameof(customer));
            ExpirationDate = expirationDate;
            PurchaseDate   = DateTime.UtcNow;
        }
예제 #2
0
 private CustomerStatus(CustomerStatusType type, ExpirationDate expirationDate) : this()
 {
     _expirationDate = expirationDate ?? throw new ArgumentNullException(nameof(expirationDate));
     Type            = type;
 }