public static void CallHistoryTest()
        {
            GSM testGSM = GSM.IPhone4s;

            testGSM.AddCall("0999-999-999", 2.3);
            testGSM.AddCall("0888-999-999", 12.4);
            testGSM.AddCall("0777-999-999", 4.34);
            testGSM.AddCall("0666-999-999", 8.2);
            testGSM.AddCall("0555-999-999", 11.2);
            Console.WriteLine("-------Showing added calls--------");
            testGSM.ShowCallHistory();

            Console.WriteLine("------Calculating total price for calls------");
            double totalCallPrice = testGSM.CalculateCallsTotalPrice();

            Console.WriteLine("{0:C}", totalCallPrice);

            Console.WriteLine("----Removing longest call and recalculating-----");
            testGSM.RemoveLongestCallEntry();
            testGSM.ShowCallHistory();
            totalCallPrice = testGSM.CalculateCallsTotalPrice();
            Console.WriteLine("{0:C}", totalCallPrice);

            Console.WriteLine("----Clearing call history-----");
            testGSM.ClearCallHistory();
            testGSM.ShowCallHistory();
        }
        public void GSMCallHistoryTesting()
        {
            // Create an instance of the GSM class.
            GSM testGsm = new GSM("Nokia", "TelerikCorp");

            // Add few calls.
            testGsm.AddCall("9873432142", 53);
            testGsm.AddCall("9811433144", 123);
            testGsm.AddCall("9872411149", 41);

            // Display the information about the calls.
            testGsm.ShowCallHistory();

            // Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history.
            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            //  Remove the longest call from the history and calculate the total price again.
            testGsm.DeleteCall(2);
            Console.WriteLine("Removed Longest call!");
            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            //// Clear the call history and print it.
            //testGsm.ClearCallHistory();
            //Console.WriteLine("Cleared call history!");
            //testGsm.ShowCallHistory();
        }
示例#3
0
        private static void GSMCallHistoryTest()
        {
            GSM testGsm = new GSM("Nokia", "TelerikCorp");

            testGsm.AddCall("+359873432142", 53);
            testGsm.AddCall("+359811432142", 123);
            testGsm.AddCall("+359872412142", 41);
            testGsm.AddCall("+359833332142", 72);
            testGsm.AddCall("+359614432142", 231);

            testGsm.ShowCallHistory();

            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            testGsm.DeleteCall(5);
            Console.WriteLine("Removed Longest call!");

            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            testGsm.ClearCallHistory();
            Console.WriteLine("Cleared call history!");
            testGsm.ShowCallHistory();
        }
示例#4
0
        public static void TestCallHistory()
        {
            Call call0 = new Call("31.3.2015 9:08:33", "00359 888888", 60);
            Call call1 = new Call("01.4.2015 22:19:04", "+44 123123", 578);
            Call call2 = new Call("02.05.2016 02:16:00", "02 967 2323", 134);

            gsm.AddCall(call0);
            gsm.AddCall(call1);
            gsm.AddCall(call2);

            gsm.ShowCallHistory();

            decimal pricePerMinute = 0.37m;

            Console.WriteLine("Total price: {0:C}", gsm.CalculateTotalPriceOfCalls(pricePerMinute));

            gsm.DeleteCall(1);

            Console.WriteLine("Total price: {0:C}", gsm.CalculateTotalPriceOfCalls(pricePerMinute));

            gsm.ClearCallHistory();

            gsm.ShowCallHistory();
        }