private static void CheckForNull(Product product) { if (product == null) { throw new ArgumentNullException("product", "Product can't be null"); } }
private static Catalog MakeCatalog(int count) { var result = new Catalog(); for (int i = 0; i < count; i++) { var product = new Product() { Name = generator.GetRandomString(5, 20), Price = generator.GetRandomNumber(1, 50) }; result.Add(product); } return result; }
public void Remove(Product product) { CheckForNull(product); this.products.Remove(product); }
public void Add(Product product) { CheckForNull(product); this.products.Add(product); }