public void Call(string number) { if (number.StartsWith("0 700")) { Console.WriteLine("Sorry, you cannot use number starts with 0 700, it's only for adults :)"); } else { _smartphone.Call(number); } }
static void Main(string[] args) { Console.WriteLine("Ordering IPhone..."); ISmartphone iphone = Shop.Order(ProductEnum.IPhone); iphone.Call(); iphone.Ring(); Console.WriteLine("Ordering Samsung M31..."); ISmartphone samsungM31 = Shop.Order(ProductEnum.SamsungM31); samsungM31.Call(); samsungM31.Ring(); }
private static void TestPhone(ISmartphone phone) { var numbersToCall = Console.ReadLine().Split(); foreach (var number in numbersToCall) { Console.WriteLine(phone.Call(number)); } var sitesToBrowse = Console.ReadLine().Split(); foreach (var site in sitesToBrowse) { Console.WriteLine(phone.Browse(site)); } }