public static void AddProducts(Store store, int numberOfProducts) { for (int i = 0; i < numberOfProducts; i++) { double price = randomPriceGenerator.Next(2001); store.Add(new Product(string.Empty, (decimal)price)); } }
public static void FindProducts(Store store, int numberOfSearhes) { for (int i = 0; i < numberOfSearhes; i++) { decimal minPrice = randomPriceGenerator.Next(101); decimal maxPrice = randomPriceGenerator.Next(700, 2001); store.FindInRange(minPrice, maxPrice); } }
public static void Main() { var store = new Store(); stopwatch.Start(); AddProducts(store, NumberOfProductsToAdd); stopwatch.Stop(); Console.WriteLine("Time elapsed for adding: {0}", stopwatch.Elapsed); stopwatch.Start(); FindProducts(store, NumberOfSearches); stopwatch.Stop(); Console.WriteLine("Time elapsed for searching: {0}", stopwatch.Elapsed); }