public void CallTest() { //Creating GSM instances List<GSM> samsung = new List<GSM>(); samsung.Add(new GSM("Galaxy S2", "Samsung")); samsung.Add(new GSM("Galaxy S3", "Samsung")); samsung.Add(new GSM("Galaxy S4", "Samsung")); GSM nokia = new GSM("Lumia 520", "Nokia"); //Adding calls List<Call> callsHistory = new List<Call>(); callsHistory.Add(new Call("0883339897", 78)); callsHistory.Add(new Call("0883352629", 134)); callsHistory.Add(new Call("0883339897", 61)); nokia.AddCall(callsHistory[0]); nokia.AddCall(callsHistory[1]); // Display the info about the calls Console.WriteLine(nokia.ToString()); Console.WriteLine(callsHistory[0]); Console.WriteLine(callsHistory[1]); Console.WriteLine(); foreach (var item in callsHistory) { Console.WriteLine(item); } Console.WriteLine(nokia.TotalPrice(callsHistory)); Console.WriteLine(); Console.WriteLine(); // Total price in call history RemoveLongestCall(callsHistory); foreach (var item in callsHistory) { Console.WriteLine(item); } Console.WriteLine(nokia.TotalPrice(callsHistory)); }
public void Test() { // //View array instances // GSM[] gsmArray = new GSM[4]; gsmArray[0] = new GSM("3310", "Nokia", "Pesho", 15, new Display("1,25 inch", 2), new Battery("Unknown")); gsmArray[1] = new GSM("Moto G", "Motorola", "Matrin Kolev", 320); gsmArray[2] = new GSM("Galaxy S5", "Samsung", "Eli", 700, new Display("5 inch"), new Battery("High capacity", 700)); gsmArray[3] = new GSM("Z5", "Sony", "Plamen", 600); // //Printing the GSM Class instances // foreach (var item in gsmArray) { Console.WriteLine(item); } Console.WriteLine(GSM.iphone4S); }