Пример #1
0
        public void CreateCustomerTest()
        {
            var threadHandler = new ThreadHandler(10);

            for (var i = 0; i < threadHandler.AmountOfCustomers; i++)
            {
                threadHandler.GenerateExtraCustomers(_bank, _bazaar);
            }
            Assert.IsTrue(threadHandler.Customers.Count == 10);
        }
Пример #2
0
        /// <summary>
        ///		Starts the whole prosess of creating threads of customers and stores
        /// </summary>
        public void StartBazaar()
        {
            _threadHandler.StartAllStoresThreads(_bazaar);

            if (_bazaar.IsBazarOpen())
            {
                _threadHandler.StartAllCustomerThreads(_bank, _bazaar);

                while (_bazaar.IsBazarOpen())
                {
                    _threadHandler.GenerateExtraCustomers(_bank, _bazaar);
                }
                EndOfDay();

                Console.WriteLine("---------------------");
                Console.WriteLine("Bazaar is now closed.");
                Console.WriteLine("---------------------");
            }
        }