public void Delete_Goal_Get_ReturnsView() { Goal fake = new Goal() { GoalId = 1, GoalName = "test", Desc = "test", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1), GoalStatusId = 1, }; goalRepository.Setup(x => x.GetById(1)).Returns(fake); GoalController controller = new GoalController(goalService, metricService, focusService, supportService, updateService, commentService, userService, securityTokenService, supportInvitationService, goalStatusService, commentUserService, updateSupportService); ViewResult result = controller.Delete(1) as ViewResult; Assert.IsNotNull(result, "View Result is null"); Assert.IsInstanceOf(typeof(Goal), result.ViewData.Model, "Wrong View Model"); var group = result.ViewData.Model as Goal; Assert.AreEqual("test", group.Desc, "Got wrong Focus Description"); }