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);
 }
 /// <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");
     }
 }
 /// <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");
     }
 }
 /// <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();
 }
 public void TestEditNonPresentFavourite()
 {
     Favourite fav = new Favourite();
     this.handler.EditFavourite(fav, "12", "12");
 }
Beispiel #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);
 }
Beispiel #7
0
 public void TestFavouriteNoName()
 {
     Favourite fav = new Favourite("http://www.google.de/", null);
 }
Beispiel #8
0
 public void TestFavouriteInvalidUrl()
 {
     Favourite fav = new Favourite("http://www.google.d/", "Test");
 }
Beispiel #9
0
 public void TestFavouriteEmtpyName()
 {
     Favourite fav = new Favourite("http://www.google.de/", "");
 }