示例#1
0
        // 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()));
        }
示例#2
0
        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));
        }
示例#3
0
        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()));
        }
示例#5
0
        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);
        }
示例#6
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);
        }