Advertisement
stefanpu

Gsm CallHistory Test

Mar 15th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3. using System.Threading;
  4.  
  5. namespace Mobile_Device
  6. {
  7.     class GSMCallHistoryTest // Task 12
  8.     {
  9.         public static void CallHistoryTest()
  10.         {
  11.             Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  12.             GSMClass MyGSM = new GSMClass("Galaxy", "Samsung", 990, "Petar Petrov", new BatteryClass("TI8287", 750, 21, BatteryType.LiIon), new DisplayClass(4.8, 16000000));
  13.             GSMClass MyGSM2 = new GSMClass("Galaxy", "Samsung", 990, "Petar Petrov", new BatteryClass("TI8287", 750, 21, BatteryType.LiIon), new DisplayClass(4.8, 16000000));
  14.  
  15.        
  16.  
  17.             MyGSM.AddCall(new Call(DateTime.Now, "0898567646",25));
  18.             MyGSM2.AddCall(new Call(DateTime.Now.AddDays(3), "087743215", 120));
  19.             MyGSM.AddCall(new Call(DateTime.Now.AddHours(1), "0887564564", 75));
  20.             MyGSM2.AddCall(new Call(DateTime.Now.AddHours(56), "0882345678", 200));
  21.  
  22.            
  23.             //Тук един обект извиква своя метод за да промени
  24.             //състоянието(нулира историята с обаждания) на друг обект. Това поведение
  25.             // не се очаква от метод като ClearHistory().
  26.             MyGSM.ClearHistory(MyGSM2.CallHistory);
  27.             //Очакваме, че са изтрити
  28.             Console.Write("After clearing the history, there are {0} calls.", MyGSM.CallHistory.Count);
  29.  
  30.             Console.WriteLine();
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement