Ejemplo n.º 1
0
        public void Supporters_Of_Updates_List()
        {
            IEnumerable<ApplicationUser> fakeUser = new List<ApplicationUser> {
            new ApplicationUser{Activated=true,Email="*****@*****.**",FirstName="user1",LastName="user1",RoleId=0},
              new ApplicationUser{Activated=true,Email="*****@*****.**",FirstName="user2",LastName="user2",RoleId=0},
              new ApplicationUser{Activated=true,Email="*****@*****.**",FirstName="user3",LastName="user3",RoleId=0},
              new ApplicationUser{Activated=true,Email="*****@*****.**",FirstName="user4",LastName="user4",RoleId=0}
              }.AsEnumerable();
            userRepository.Setup(x => x.GetAll()).Returns(fakeUser);
            IEnumerable<UpdateSupport> fake = new List<UpdateSupport> {
            new UpdateSupport { UpdateSupportId =1, UpdateId = 1, UserId ="402bd590-fdc7-49ad-9728-40efbfe512ec"},
            new UpdateSupport { UpdateSupportId =2, UpdateId = 1, UserId ="402bd590-fdc7-49ad-9728-40efbfe512ed"},
            new UpdateSupport { UpdateSupportId =3, UpdateId = 1, UserId ="402bd590-fdc7-49ad-9728-40efbfe512ef"},

              }.AsEnumerable();
            updateSupportRepository.Setup(x => x.GetMany(It.IsAny<Expression<Func<UpdateSupport, bool>>>())).Returns(fake);
            GoalController controller = new GoalController(goalService, metricService, focusService, supportService, updateService, commentService, userService, securityTokenService, supportInvitationService, goalStatusService, commentUserService, updateSupportService);
            PartialViewResult result = controller.SupportersOfUpdate(1) as PartialViewResult;
            Assert.IsNotNull(result);
            Assert.IsInstanceOf(typeof(UpdateSupportersViewModel), result.ViewData.Model, "Wrong View Model");
        }