Пример #1
0
        public void TestingGSM()
        {
            Battery phoneOneBattery = new Battery("Samsung Batery", 48, 12, BatteryType.Li_lon);
            Display phoneOneDisplay = new Display(5.7, 12000);
            GSM     phoneOne        = new GSM("Galaxy A6", "Samsung", phoneOneBattery, phoneOneDisplay, owner: "Peter", price: 600);

            Battery phoneTwoBattery = new Battery("iPhone Batery", 60, 24, BatteryType.NiMH);
            Display phoneTwoDisplay = new Display(4.5, 154000000);
            GSM     phoneTwo        = new GSM("4S", "iPhone", phoneTwoBattery, phoneTwoDisplay, owner: "Gosho", price: 1100);

            List <GSM> phones = new List <GSM>();

            phones.Add(phoneOne);
            phones.Add(phoneTwo);

            for (int i = 0; i < phones.Count; i++)
            {
                Console.WriteLine($"{i + 1}." + Environment.NewLine + phones[i] + Environment.NewLine);
            }

            Console.WriteLine(GSM.iPhone4S);
        }
        public void GSMCallHistoryTesting()
        {
            GSM testGsm = new GSM("Nokia", "Telerik");

            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();
        }