示例#1
0
        public void TestCalls()
        {
            gsm.AddCall("5/1/2008 8:30:52 AM", 2030, 120);
            gsm.AddCall("6/1/2008 10:50:52 AM", 3040, 360);
            gsm.AddCall("7/1/2008 11:33:52 AM", 4050, 200);

            PrintDetails(gsm);

            Console.WriteLine("Total Call Cost: {0:0.00}$\n", gsm.GetCallsCost(0.37f));

            float longestDuration = gsm.CallHistory[0].CallDurationInSeconds;

            for (int i = 1; i < gsm.CallHistory.Count; i++)
            {
                if (gsm.CallHistory[i].CallDurationInSeconds > longestDuration)
                {
                    longestDuration = gsm.CallHistory[i].CallDurationInSeconds;
                }
            }

            gsm.RemoveCall(longestDuration);
            Console.WriteLine("Total Call Cost After Longest Call Removal: {0:0.00}$\n", gsm.GetCallsCost(0.37f));
            gsm.ClearCallHistory();
            Console.WriteLine("Now cleared\n");
            PrintDetails(gsm);
        }