private static OrderQueue GenerateOrders(int numberOfOrders, IEnumerable <Product> products) { var rand = new Random(); int productCount = products.Count(); OrderQueue queue = new OrderQueue(); for (int i = 0; i < numberOfOrders; i++) { var product = products.ElementAt(rand.Next(productCount)); queue.Enqueue(new Order() { Product = product, Quantity = rand.Next(10), DeliveryAddress = new Address() }); } return(queue); }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Example3.DeliveryPerson"/> class. /// </summary> /// <param name='orderQueue'> /// Order queue. /// </param> public DeliveryPerson(SimulationContext context, OrderQueue orderQueue) : base(context) { _orderQueue = orderQueue; }
private static IEnumerable <DeliveryPerson> CreateDeliveryPeople(int numberOfDeliveryPeople, OrderQueue queue) { var deliveryPeople = new List <DeliveryPerson>(); for (int i = 0; i < numberOfDeliveryPeople; i++) { deliveryPeople.Add(new DeliveryPerson(queue)); } return(deliveryPeople); }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Example3.DeliveryPerson"/> class. /// </summary> /// <param name='orderQueue'> /// Order queue. /// </param> public DeliveryPerson(OrderQueue orderQueue) { _orderQueue = orderQueue; }