public void Delete_Update_Get_ReturnsView() { Update update = new Update() { UpdateId = 1, Updatemsg = "abc", GoalId = 1, }; updateRepository.Setup(x => x.GetById(1)).Returns(update); GoalController controller = new GoalController(goalService, metricService, focusService, supportService, updateService, commentService, userService, securityTokenService, supportInvitationService, goalStatusService, commentUserService, updateSupportService); PartialViewResult result = controller.DeleteUpdate(1) as PartialViewResult; Assert.IsNotNull(result, "View Result is null"); Assert.IsInstanceOf(typeof(Update), result.ViewData.Model, "Wrong View Model"); var group = result.ViewData.Model as Update; Assert.AreEqual("abc", group.Updatemsg, "Got wrong message"); }