Exemple #1
0
        public static void Main()
        {
            // GSM Test
            List <GSM> phones = GSMTest.GeneratePhones();

            // Print information on the console for all instances of phones
            PrintSeparator("GSM Test");
            foreach (var phone in phones)
            {
                Console.WriteLine(phone.ToString());
            }

            // Call History test
            PrintSeparator("Call history test");

            GSM gsm = CallHistoryTest.GenerateCallHistory();

            // Print on the console the call history
            PrintCallHistory(gsm);

            Console.WriteLine("Removing longest call from call history...");
            Console.WriteLine();

            // Remove longest call from call history
            Call longestCall = gsm.CallHistory[0];

            foreach (var call in gsm.CallHistory)
            {
                if (call.Duration > longestCall.Duration)
                {
                    longestCall = call;
                }
            }

            gsm.RemoveCall(longestCall);

            // Print on the console the call history
            PrintCallHistory(gsm);

            // Clear call history
            gsm.DeleteCallHistory();

            // Print after deleting call history
            PrintCallHistory(gsm);
        }