Beispiel #1
0
 private static void CheckForNull(Product product)
 {
     if (product == null)
     {
         throw new ArgumentNullException("product", "Product can't be null");
     }
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 public void Remove(Product product)
 {
     CheckForNull(product);
     this.products.Remove(product);
 }
Beispiel #4
0
 public void Add(Product product)
 {
     CheckForNull(product);
     this.products.Add(product);
 }