// GET: Photos public ActionResult Index() { model.ConnectionUsers = user_Service.GetAllUsers(); model.ConnectionUserStatuses = status_Service.GetLatestStatuses(); model.ConnectionFriendlist = friend_Service.GetAllFriends(this.User.Identity.Name); model.ConnectionGroups = group_Service.GetAllGroups(); model.ConnectionComments = comment_Service.GetAllComments(); var photo = db.Photos.Include(c => c.User); return(View(db.Photos.ToList())); }
public ActionResult Index() { //Instances filled with content model.ConnectionUsers = user_Service.GetAllUsers(); model.ConnectionUserStatuses = status_Service.GetLatestStatuses(); model.ConnectionFriendlist = friend_Service.GetAllFriends(this.User.Identity.Name); model.ConnectionGroups = group_Service.GetAllGroups(); model.ConnectionComments = comment_Service.GetAllComments(); //return the model with initialized content to be used in the views. return(View(model)); }
public void GetAllFriends_ShouldReturnEmptyList_ShouldReturnRightAmountOfFriends() { var repoMocked = new Mock <IDbRepository <FriendsList> >(); var friendLists = new List <FriendsList>() { new FriendsList() { Name = "friendList", Friends = new List <Friend>() { new Friend() { Name = "testUser" } } } }; repoMocked.Setup(m => m.All()).Returns(friendLists.AsQueryable()); var service = new FriendListService(repoMocked.Object); var friends = service.GetAllFriends("friendList"); Assert.AreEqual(friends.Count, 1); }
// GET: UserStatus public ActionResult Index() { //Instances filled with content model.ConnectionUsers = user_Service.GetAllUsers(); model.ConnectionUserStatuses = status_Service.GetLatestStatuses(); model.ConnectionFriendlist = friend_Service.GetAllFriends(this.User.Identity.Name); model.ConnectionGroups = group_Service.GetAllGroups(); model.ConnectionComments = comment_Service.GetAllComments(); return(View(db.UserStatuses.ToList())); }
public void GetAllFriends_ShouldReturnEmptyList_WhenNoFriendListFound() { var repoMocked = new Mock <IDbRepository <FriendsList> >(); var friendLists = new List <FriendsList>(); repoMocked.Setup(m => m.All()).Returns(friendLists.AsQueryable()); var service = new FriendListService(repoMocked.Object); var friends = service.GetAllFriends("friendList"); Assert.AreEqual(friends.Count, 0); }
public void GetAllFriends_ShouldCall_AllOnce() { var repoMocked = new Mock <IDbRepository <FriendsList> >(); var friendLists = new List <FriendsList>(); repoMocked.Setup(m => m.All()).Returns(friendLists.AsQueryable()); var service = new FriendListService(repoMocked.Object); service.GetAllFriends("friendList"); repoMocked.Verify(m => m.All(), Times.Once); }