public static void Run() { IEmailSender emailSender = new FakeEmailSender(); IDatabase database = new Database(); IUserService userService = new UserService(database, emailSender); try { var user = userService.Register("*****@*****.**", "secret"); user.Item.DisplayName(); } catch (InvalidValueException exception) { Console.WriteLine($"My exception: {exception.Message}."); } catch (Exception exception) { Console.WriteLine($"Error: {exception.Message}."); throw; } // finally // { // Console.WriteLine($"Finally"); // } // var user = new User("*****@*****.**", "secret"); // user.Item.DisplayEmail(); // var admin = new Administrator("*****@*****.**", "secret"); // admin.DisplayEmail(); // List<User> users = new List<User> // { // user.Item, admin // }; // foreach(var currentUser in users) // { // // currentUser.DisplayEmail(); // } // DisplayEmail(user.Item); // DisplayEmail(admin); }