コード例 #1
0
        protected Product(string name, string description, int price)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Name must be given", nameof(name));
            }
            if (string.IsNullOrWhiteSpace(description))
            {
                throw new ArgumentException("Description must be given", nameof(description));
            }

            ProductInformation = new ProductInformation(name, description);
            Price = price;
        }
コード例 #2
0
        protected Product(string name, int price)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Name must be given", nameof(name));
            }
            if (price <= 0)
            {
                throw new ArgumentException("Price must be above 0", nameof(price));
            }

            ProductInformation = new ProductInformation(name);
            Price = price;
        }
コード例 #3
0
 public void UpdateDescription(string description)
 {
     ProductInformation.UpdateDescription(description);
 }
コード例 #4
0
 public void UpdateName(string name)
 {
     ProductInformation.UpdateName(name);
 }