public ItemPile(StockKeepingUnit unit, int quantity) { if (quantity < 0) { throw new InvalidOperationException(); } Unit = unit; Quantity = quantity; }
public override bool Equals(object obj) { StockKeepingUnit other = obj as StockKeepingUnit; if (ReferenceEquals(other, null)) { return(false); } if (!other.Name.Equals(Name, StringComparison.CurrentCultureIgnoreCase)) { return(false); } if (other.Price != Price) { return(false); } return(true); }