public void TestIndexer() { Favorite f1 = new Favorite("Home", new Uri("https://www.it-tallaght.ie")); Favorite f2 = new Favorite("About Us", new Uri("https://www.it-tallaght.ie")); FavoritesCollection fc = new FavoritesCollection(); fc.AddFavorite(f1); fc.AddFavorite(f2); List <Favorite> favoriteList = new List <Favorite>(); favoriteList.Add(f1); // Indexer adding based on name List <Favorite> nameList = new List <Favorite>(); foreach (Favorite f in fc) { if (f.Name == "Home") { nameList.Add(f); } else { break; } } // checks both lists are equal CollectionAssert.AreEqual(favoriteList, nameList); }
public void TestAddFavorite2() { Favorite f1 = new Favorite("Home", new Uri("https://www.it-tallaght.ie")); FavoritesCollection fc = new FavoritesCollection(); fc.AddFavorite(f1); fc.AddFavorite(f1); }
public void TestRemoveFavorite2() { Favorite f1 = new Favorite("Home", new Uri("https://www.it-tallaght.ie")); Favorite f2 = new Favorite("About Us", new Uri("https://www.it-tallaght.ie")); FavoritesCollection fc = new FavoritesCollection(); fc.AddFavorite(f1); fc.AddFavorite(f2); fc.RemoveFavorite("Cool Things"); }
public void TestAddFavorite1() { Favorite f1 = new Favorite("Home", new Uri("https://www.it-tallaght.ie")); Favorite f2 = new Favorite("About Us", new Uri("https://www.it-tallaght.ie")); FavoritesCollection fc = new FavoritesCollection(); fc.AddFavorite(f1); fc.AddFavorite(f2); CollectionAssert.Contains(fc.FavoriteList, f1); CollectionAssert.Contains(fc.FavoriteList, f2); }
public MainPageViewModel() { WorldNews = new ObservableCollection <News.NewsInformation>(); TechnologyNews = new ObservableCollection <News.NewsInformation>(); TrendingNews = new ObservableCollection <News.NewsInformation>(); Favorites = new FavoritesCollection(); CurrentUser = new UserInformation { DisplayName = "Scott", BioContent = "Scott has been developing Microsoft Enterprise solutions for organizations around the world for the last 28 years, and is the Senior Architect & Developer behind Liquid Daffodil.", ProfileImageUrl = "https://wintellectnow.blob.core.windows.net/public/Scott_Peterson.jpg" }; }