Esempio n. 1
0
        public void TestProjectController_ProjectUndelete_ShouldReturnRedirectToActionProject(string httpMethod)
        {
            SetUpProjectControllerForTesting(httpMethod);
            projectController.CurrentUser = user;

            projectController.ViewData["PageMessages"] = new Messages();
            projectController.ViewData["KeyMessages"]  = new Messages();

            long _projectId = this.db.Context.Projects.Where(p => p.OwnerId == user.UserId && p.Deleted == true)
                              .OrderByDescending(p => p.ProjectId)
                              .Select(p => p.ProjectId)
                              .FirstOrDefault();

            ProjectModel          model  = projectService.GetProjectModel(user, _projectId).Model as ProjectModel;
            RedirectToRouteResult result = projectController.ProjectUndelete(model) as RedirectToRouteResult;

            Assert.That(result, Is.Not.EqualTo(null));

            Assert.That(result.RouteValues["action"], Is.EqualTo("Project"));
            Assert.That(result.RouteValues["controller"], Is.EqualTo("Projectdashboard"));
            Assert.That(result.RouteValues["ProjectId"], Is.EqualTo(_projectId));
            Assert.That(result.RouteValues["Active"], Is.EqualTo(true));
            Assert.That(result.RouteValues["Deleted"], Is.EqualTo(false));
            Assert.That(result.RouteValues["OwnerId"], Is.EqualTo(user.UserId));
        }