コード例 #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();
        }
コード例 #2
0
        // 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);
        }