Exemplo n.º 1
0
 private static void TestFriends(MyUser user)
 {
     Console.WriteLine("Test the friends functions");
     try
     { // Adding three smugmug heroes as friends
         user.AddFriend("baldy");
         user.AddFriend("markabby");
         user.AddFriend("beanland");
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     Console.WriteLine();
     try
     {
         // Get a list of your friends and display it
         var myFriendsList = user.GetFriends();
         if (myFriendsList != null)
         {
             foreach (var x in myFriendsList)
             {
                 Console.WriteLine(x.Name + ' ' + x.URL);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     Console.WriteLine();
     try
     {
         // Removing someone from friends
         user.RemoveFriend("baldy");
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     Console.WriteLine();
     try
     {
         // Remove all friends
         user.RemoveAllFriends();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     Console.WriteLine();
 }