示例#1
0
        public void Goals_List()
        {
            IEnumerable<Goal> fake = new List<Goal> {
            new Goal { GoalName = "Test1", Desc="Test1Desc"},
            new Goal { GoalName = "Test2", Desc="Test2Desc"},

              }.AsEnumerable();
            goalRepository.Setup(x => x.GetMany(It.IsAny<Expression<Func<Goal, bool>>>())).Returns(fake);
            GoalController controller = new GoalController(goalService, metricService, focusService, supportService, updateService, commentService, userService, securityTokenService, supportInvitationService, goalStatusService, commentUserService, updateSupportService);
            PartialViewResult result = controller.Goalslist(0, 0) as PartialViewResult;
            Assert.IsNotNull(result);
            Assert.IsInstanceOf(typeof(IEnumerable<Goal>), result.ViewData.Model, "Wrong View Model");
            var gol = result.ViewData.Model as IEnumerable<Goal>;
            Assert.AreEqual(2, gol.Count(), "Got wrong number of Goals");
        }