public string TestCallHistory() { Call call1 = new Call(Date, StartTime1, Duration1); Call call2 = new Call(Date, StartTime2, Duration2); Call call3 = new Call(Date, StartTime3, Duration3); GSM gsm = new GSM(Model, Manufacturer, Price, Owner, BatteryModel, HoursIdle, HoursTalk, BatteryType1, DisplaySze, DisplayColors); gsm.CallHistory.Add(call1); gsm.CallHistory.Add(call2); gsm.CallHistory.Add(call3); StringBuilder callHistoryBuilder = new StringBuilder(); callHistoryBuilder.AppendLine(gsm.GetCallHistory()); callHistoryBuilder.AppendLine(gsm.CalculateBill(PricePerMinute)); Call longestCall = gsm.CallHistory.OrderByDescending(c => c.Duration).FirstOrDefault(); if (longestCall != null) { gsm.CallHistory.Remove(longestCall); } callHistoryBuilder.AppendLine(gsm.CalculateBill(PricePerMinute)); gsm.ClearCallHistory(); callHistoryBuilder.AppendLine(gsm.CalculateBill(PricePerMinute)); callHistoryBuilder.AppendLine(gsm.GetCallHistory()); return(callHistoryBuilder.ToString().TrimEnd()); }
public string TestGSM() { GSM[] gsms = new GSM[] { new GSM(Model, Manufacturer, Price, Owner), new GSM(Model, Manufacturer, Price, Owner, BatteryModel, HoursIdle, HoursTalk, BatteryType1, DisplaySze, DisplayColors), new GSM(Model, Manufacturer, Price, Owner, BatteryModel, HoursIdle, HoursTalk, DisplaySze, DisplayColors) }; StringBuilder gsmBuilder = new StringBuilder(); foreach (GSM gsm in gsms) { gsmBuilder.AppendLine(gsm.ToString()); } gsmBuilder.Append(GSM.GetNokiaN95()); return(gsmBuilder.ToString()); }