Пример #1
0
        static void Main()
        {
            // Manual tests - start
            Battery lightBattery = new Battery("Nikel-Mh", 200, 50, BatteryType.NiMH);
            Battery meddiumBattery = new Battery("Nikel-Cd", BatteryType.NiCd);
            Battery goodBattery = new Battery("Nikel-Cd", 300, 90, BatteryType.NiCd);

            Console.WriteLine(lightBattery.ToString());
            Console.WriteLine(meddiumBattery.ToString());

            Display badDisplay = new Display(5.5, 256);
            Display goodDisplay = new Display(13, 120000000);
            Console.WriteLine(goodDisplay.ToString());

            Call firstCall = new Call(DateTime.Parse("08/03/2015 09:30:25"), "0888123456", 3.25);
            Call secondCall = new Call(DateTime.Parse("09/03/2015 10:30:25"), "0888456123", 4.23);

            List<Call> calls = new List<Call>();

            GSM sonyGsm = new GSM("Xperia T", "Sony", 1000, "Pesho Goshov", goodBattery, goodDisplay, calls);

            sonyGsm.AddCall(firstCall);
            sonyGsm.AddCall(secondCall);

            Console.WriteLine(sonyGsm.ToString());
            Console.WriteLine(sonyGsm.PrintCallHistory());

            sonyGsm.DeleteCall(secondCall);
            Console.WriteLine(sonyGsm.PrintCallHistory());

            sonyGsm.ClearCallHistory();
            Console.WriteLine(sonyGsm.PrintCallHistory());

            GSM.IPhone = new GSM("4s", "IPhone", 1100, "Sulio Puljov", lightBattery, badDisplay, new List<Call>());
            Console.WriteLine(GSM.IPhone.ToString());
            // Manual tests - end

            // Automated GSM tests with GSMTest class - start
            Battery iPhoneBattery = new Battery("Nikel-Mh", 200, 50, BatteryType.NiMH);
            Display iPhoneDisplay = new Display(10.2, 1200000);
            GSM.IPhone = new GSM("4s", "IPhone", 1100, "Sulio Puljov", iPhoneBattery, iPhoneDisplay, new List<Call>());

            GSMTest.PrintPhonesInfo(GSMTest.GenerateGSM(3)); //problem 7

            Console.WriteLine(new string('-', 50));
            // Automated GSM tests with GSMTest class - end

            // Automated GSM call history with GSMCallHistoryTest class - start
            GSMCallHistoryTest.CreateCallTestHistory();

            GSMCallHistoryTest.DisplayCallTestHistory();

            GSMCallHistoryTest.CalculateAndPrintTestCallsPrice();

            GSMCallHistoryTest.RemoveLongestCall();

            GSMCallHistoryTest.CalculateAndPrintTestCallsPrice();
            // Automated GSM call history with GSMCallHistoryTest class - end
        }
Пример #2
0
        public static void PrintPhonesInfo(GSM[] phones)
        {
            for (int i = 0; i < phones.Length; i++)
            {
                Console.WriteLine("Sample GSM {0}: {1}", i + 1, phones[i]);
                Console.WriteLine(new string('-', 50));
            }

            Console.WriteLine("IPhone info: {0}", GSM.IPhone);
        }
Пример #3
0
        public static GSM[] GenerateGSM(int number)
        {
            GSM[] phones = new GSM[number];

            Random random = new Random();

            for (int i = 0; i < number; i++)
            {
                int col = random.Next(0, models.GetLength(1));
                int row = random.Next(1, models.GetLength(0));

                phones[i] = new GSM(manufacturers[col], models[row, col], random.Next(1, 2001),
                    owners[random.Next(0, owners.Length)], batteries[random.Next(0, batteries.Length)],
                    displays[random.Next(0, displays.Length)], new List<Call>());
            }

            return phones;
        }
Пример #4
0
        public static GSM[] GenerateGSM(int number)
        {
            GSM[] phones = new GSM[number];

            Random random = new Random();

            for (int i = 0; i < number; i++)
            {
                int col = random.Next(0, models.GetLength(1));
                int row = random.Next(1, models.GetLength(0));

                phones[i] = new GSM(manufacturers[col], models[row, col], random.Next(1, 2001),
                                    owners[random.Next(0, owners.Length)], batteries[random.Next(0, batteries.Length)],
                                    displays[random.Next(0, displays.Length)], new List <Call>());
            }

            return(phones);
        }
Пример #5
0
        static void Main()
        {
            // Manual tests - start
            Battery lightBattery   = new Battery("Nikel-Mh", 200, 50, BatteryType.NiMH);
            Battery meddiumBattery = new Battery("Nikel-Cd", BatteryType.NiCd);
            Battery goodBattery    = new Battery("Nikel-Cd", 300, 90, BatteryType.NiCd);

            Console.WriteLine(lightBattery.ToString());
            Console.WriteLine(meddiumBattery.ToString());

            Display badDisplay  = new Display(5.5, 256);
            Display goodDisplay = new Display(13, 120000000);

            Console.WriteLine(goodDisplay.ToString());


            Call firstCall  = new Call(DateTime.Parse("08/03/2015 09:30:25"), "0888123456", 3.25);
            Call secondCall = new Call(DateTime.Parse("09/03/2015 10:30:25"), "0888456123", 4.23);

            List <Call> calls = new List <Call>();

            GSM sonyGsm = new GSM("Xperia T", "Sony", 1000, "Pesho Goshov", goodBattery, goodDisplay, calls);

            sonyGsm.AddCall(firstCall);
            sonyGsm.AddCall(secondCall);

            Console.WriteLine(sonyGsm.ToString());
            Console.WriteLine(sonyGsm.PrintCallHistory());

            sonyGsm.DeleteCall(secondCall);
            Console.WriteLine(sonyGsm.PrintCallHistory());

            sonyGsm.ClearCallHistory();
            Console.WriteLine(sonyGsm.PrintCallHistory());

            GSM.IPhone = new GSM("4s", "IPhone", 1100, "Sulio Puljov", lightBattery, badDisplay, new List <Call>());
            Console.WriteLine(GSM.IPhone.ToString());
            // Manual tests - end


            // Automated GSM tests with GSMTest class - start
            Battery iPhoneBattery = new Battery("Nikel-Mh", 200, 50, BatteryType.NiMH);
            Display iPhoneDisplay = new Display(10.2, 1200000);

            GSM.IPhone = new GSM("4s", "IPhone", 1100, "Sulio Puljov", iPhoneBattery, iPhoneDisplay, new List <Call>());

            GSMTest.PrintPhonesInfo(GSMTest.GenerateGSM(3)); //problem 7

            Console.WriteLine(new string('-', 50));
            // Automated GSM tests with GSMTest class - end

            // Automated GSM call history with GSMCallHistoryTest class - start
            GSMCallHistoryTest.CreateCallTestHistory();

            GSMCallHistoryTest.DisplayCallTestHistory();

            GSMCallHistoryTest.CalculateAndPrintTestCallsPrice();

            GSMCallHistoryTest.RemoveLongestCall();

            GSMCallHistoryTest.CalculateAndPrintTestCallsPrice();
            // Automated GSM call history with GSMCallHistoryTest class - end
        }