Пример #1
0
        public Product(string name = null, double price = 0.0, IVat vat = null)
        {
            Id    = Count++;
            Name  = name ?? RandomProductNameGenerator.Generate();
            Price = price;

            Vat = vat ?? new Vat();
        }
        // Create a product
        public static IProduct CreateNew(int priceRange = 100, IVat vat = null, ICompany store = null)
        {
            String productName  = RandomProductNameGenerator.Generate();
            int    productPrice = _random.Next(1, priceRange);
            var    product      = new Product(productName, productPrice, vat);

            if (store != null)
            {
                product.Company = store;
            }

            return(product);
        }