internal static void AddFavoriteIntoGroups(IPersistence persistence, IFavorite toPerisist, IEnumerable <string> validGroupNames) { foreach (string groupName in validGroupNames) { IGroup group = FavoritesFactory.GetOrAddNewGroup(persistence, groupName); group.AddFavorite(toPerisist); } }
public void AddFavorite_CachesAddedFavorite() { IGroup group = this.AddGroupAToPrimaryPersistence(); DbFavorite favorite = this.AddFavoriteToPrimaryPersistence(); group.AddFavorite(favorite); List <IFavorite> favorites = group.Favorites; Assert.AreEqual(1, favorites.Count, "Group favorites count doesn't match."); Assert.AreEqual(1, this.updatedCount, "Group update event didn't reach properly."); }
internal Tuple <IFavorite, IGroup> AddFavoriteWithGroup(string groupName) { IFavorite favorite = this.AddFavorite(); IGroup group = this.Persistence.Factory.CreateGroup(groupName); group.AddFavorite(favorite); this.Favorites.UpdateFavorite(favorite, new List <IGroup>() { group }); return(new Tuple <IFavorite, IGroup>(favorite, group)); }