public void Edit_Group_Get_ReturnsView() { Group group = new Group() { GroupId = 1, GroupName = "Test", Description = "test" }; groupRepository.Setup(x => x.GetById(1)).Returns(group); Mapper.CreateMap<Group, GroupFormModel>(); GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService); ViewResult actual = controller.EditGroup(1) as ViewResult; Assert.IsNotNull(actual, "View Result is null"); Assert.IsInstanceOf(typeof(GroupFormModel), actual.ViewData.Model, "Wrong View Model"); }
public void Edit_Group_Post() { GroupController controller = new GroupController(groupService, groupUserService, userService, metricService, focusService, groupgoalService, groupInvitationService, securityTokenService, groupUpdateService, groupCommentService, goalStatusService, groupRequestService, followUserService, groupCommentUserService, groupUpdateSupportService, groupUpdateUserService); // Act Mapper.CreateMap<GroupFormModel, Group>(); GroupFormModel group = new GroupFormModel() { UserId = "402bd590-fdc7-49ad-9728-40efbfe512ec", CreatedDate = DateTime.Now, Description = "Mock", GroupName = "Mock", GroupId = 1 }; var result = (RedirectToRouteResult)controller.EditGroup(group); Assert.AreEqual("Index", result.RouteValues["action"]); }