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"); }