예제 #1
0
 public void TestDeleteNonPresentFavourite()
 {
     Favourite fav = new Favourite();
     int length = this.handler.Favourites.Count;
     this.handler.DeleteFavourite(fav);
     int lengthAfterRemoval = this.handler.Favourites.Count;
     Assert.AreEqual(length, lengthAfterRemoval);
 }
예제 #2
0
 /// <summary>
 /// Edits the favourite.
 /// </summary>
 /// <param name="fav">The fav.</param>
 /// <param name="newName">The new name.</param>
 /// <param name="newUrl">The new URL.</param>
 public void EditFavourite(Favourite fav, String newName, String newUrl)
 {
     if (fav != null)
     {
         Boolean favouritePresent = false;
         foreach (Favourite favourite in this.Favourites)
         {
             if (favourite.Equals(fav))
             {
                 favourite.Name = newName;
                 favourite.Url = newUrl;
                 favouritePresent = true;
             }
         }
         if (!favouritePresent)
         {
             throw new ArgumentException("The favourite that should be changed was not found.");
         }
         this.Notify();
     }
     else
     {
         throw new ArgumentNullException("The provided favourite-reference was null");
     }
 }
예제 #3
0
 /// <summary>
 /// Deletes the favourite.
 /// </summary>
 /// <param name="fav">The fav.</param>
 public void DeleteFavourite(Favourite fav)
 {
     if (fav != null)
     {
         this.Favourites.Remove(fav);
         this.Notify();
     }
     else
     {
         throw new ArgumentNullException("The provided favourite-reference was null");
     }
 }
예제 #4
0
 /// <summary>
 /// Adds the entry.
 /// </summary>
 /// <param name="url">The URL.</param>
 public void AddEntry(String name, String url)
 {
     Favourite favourite = new Favourite(url, name);
     this.Favourites.Add(favourite);
     this.Notify();
 }
예제 #5
0
 public void TestEditNonPresentFavourite()
 {
     Favourite fav = new Favourite();
     this.handler.EditFavourite(fav, "12", "12");
 }
예제 #6
0
 public void TestFavouriteValidUrl()
 {
     Favourite fav = new Favourite("http://www.google.de/", "Test");
     Assert.AreEqual("Test", fav.Name);
     Assert.AreEqual("http://www.google.de/", fav.Url);
 }
예제 #7
0
 public void TestFavouriteNoName()
 {
     Favourite fav = new Favourite("http://www.google.de/", null);
 }
예제 #8
0
 public void TestFavouriteInvalidUrl()
 {
     Favourite fav = new Favourite("http://www.google.d/", "Test");
 }
예제 #9
0
 public void TestFavouriteEmtpyName()
 {
     Favourite fav = new Favourite("http://www.google.de/", "");
 }