static void Main(string[] args)
		{
			var repository = new InMemoryCustomerRepository();
			var service = new CustomerService(repository);
			var random = new Random();

			Console.WriteLine("Press 'q' and hit ENTER to quit.");
			Console.WriteLine("Press any other key and ENTER to get customers.");
			Console.WriteLine("");
			
			while (Console.ReadKey().Key != ConsoleKey.Q)
			{
				var facilityId = CheckIf.IsEven(random.Next(1, 100)) 
					? 2 
					: 1;

				try
				{
					var customers = service.GetCustomers(facilityId);
					DisplayCustomers(facilityId, customers);
				}
				catch (Exception)
				{
					DisplayFailure(facilityId);
				}
			}

			Console.ReadLine();
		}
Exemple #2
0
        static void Main(string[] args)
        {
            var repository = new InMemoryCustomerRepository();
            var service    = new CustomerService(repository);
            var random     = new Random();

            Console.WriteLine("Press 'q' and hit ENTER to quit.");
            Console.WriteLine("Press any other key and ENTER to get customers.");
            Console.WriteLine("");

            while (Console.ReadKey().Key != ConsoleKey.Q)
            {
                var facilityId = CheckIf.IsEven(random.Next(1, 100))
                                        ? 2
                                        : 1;

                try
                {
                    var customers = service.GetCustomers(facilityId);
                    DisplayCustomers(facilityId, customers);
                }
                catch (Exception)
                {
                    DisplayFailure(facilityId);
                }
            }

            Console.ReadLine();
        }