public void CreateUpdate(GroupUpdate update, string userId)
 {
     groupUpdateRepository.Add(update);
     SaveUpdate();
     var groupUpdateUser = new GroupUpdateUser { UserId = userId, GroupUpdateId = update.GroupUpdateId };
     groupUpdateUserRepository.Add(groupUpdateUser);
     SaveUpdate();
 }
 public void EditUpdate(GroupUpdate update)
 {
     groupUpdateRepository.Update(update);
     SaveUpdate();
 }
        public void Delete_Update_Get_ReturnsView()
        {

            GroupUpdate update = new GroupUpdate()
            {
                GroupUpdateId = 1,
                Updatemsg = "abc",
                GroupGoalId = 1,

            };
            groupUdateRepository.Setup(x => x.GetById(1)).Returns(update);

            GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService);
            PartialViewResult result = controller.DeleteUpdate(1) as PartialViewResult;
            Assert.IsNotNull(result, "View Result is null");
            Assert.IsInstanceOf(typeof(GroupUpdate),
                 result.ViewData.Model, "Wrong View Model");
            var group = result.ViewData.Model as GroupUpdate;
            Assert.AreEqual("abc", group.Updatemsg, "Got wrong message");

        }
        public void Delete_Update_Post()
        {

            GroupUpdate update = new GroupUpdate()
            {
                GroupUpdateId = 1,
                Updatemsg = "abc",
                GroupGoalId = 1,

            };
            groupUdateRepository.Setup(x => x.GetById(1)).Returns(update);
            GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService);
            var result = controller.DeleteConfirmedUpdate(1) as RedirectToRouteResult;
            Assert.AreEqual("GroupGoal", result.RouteValues["action"]);

        }
        public void Edit_Update_Get_View()
        {

            GroupUpdate update = new GroupUpdate()
            {
                GroupUpdateId = 1,
                Updatemsg = "abc",
                GroupGoalId = 1,

            };
            groupUdateRepository.Setup(x => x.GetById(1)).Returns(update);

            GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService);
            Mapper.CreateMap<GroupUpdate, GroupUpdateFormModel>();
            PartialViewResult result = controller.EditUpdate(1) as PartialViewResult;
            Assert.IsNotNull(result, "View Result is null");
            Assert.IsInstanceOf(typeof(GroupUpdateFormModel),
                result.ViewData.Model, "Wrong View Model");
            var data = result.ViewData.Model as GroupUpdateFormModel;
            Assert.AreEqual("abc", data.Updatemsg);
        }