예제 #1
0
        public void TestSimpleTaskSearch()
        {
            //Arrange
            ISearchRepository repository = new SearchRepository();
            User u = new User();
            u.Username = "******";
            u.Password = "******";
            Project p = new Project();
            p.Name = "Testprojekt";
            p.Owner = u;
            Task t1 = new Task();
            t1.Title = "Schreiben des Rhbs";
            t1.Project = p;
            Task t2 = new Task();
            t2.Title = "Dialog implementieren";
            t2.Project = p;
            Task t3 = new Task();
            t3.Title = "Schreiben von Unit test";
            t3.Project = p;
            p.ProductBacklog.Add(t1);
            p.ProductBacklog.Add(t2);
            p.ProductBacklog.Add(t3);
            IProjectRepository projectRepository = new ProjectRepository();
            projectRepository.SaveOrUpdate(p);

            //Act
            IList result = repository.Search("Title:Schreiben*");

            //Assert
            Assert.AreEqual(2, result.Count);
        }
예제 #2
0
        public ActionResult Edit(Project project)
        {
            if(this.ProjectService.EditProject(project, this.User.Identity.Name))
            {
                return RedirectToAction("Show", new { id = project.Id });
            }

            return View(project);
        }
예제 #3
0
        public ActionResult Create(Project project)
        {
            if(this.ProjectService.CreateProject(project, this.User.Identity.Name))
            {
                return RedirectToAction("Index");
            }

            return View("Create");
        }
예제 #4
0
        public void Delete(Project project)
        {
            if (project == null) throw new ArgumentNullException("project");

            ISession session = PersistenceManager.CurrentSession;
            using(ITransaction trans = session.BeginTransaction())
            {
                session.Delete(project);
                trans.Commit();
            }
        }
예제 #5
0
        public bool EditProject(Project project, string strUsername)
        {
            if (project == null) throw new ArgumentNullException("project");

            if (!string.IsNullOrEmpty(strUsername))
            {
                User user = this.UserRepository.GetByUsername(strUsername);
                project.Owner = user;
            }

            this.ProjectRepository.SaveOrUpdate(project);

            return true;
        }
예제 #6
0
        public Project LoadProductBacklog(Project project)
        {
            if(project == null) throw new ArgumentNullException("project");

            IList<Task> listTasks;

            ISession session = PersistenceManager.CurrentSession;
            using(ITransaction trans = session.BeginTransaction())
            {
                listTasks = session.CreateQuery("FROM Task t WHERE t.Project = :tProject").SetEntity("tProject", project).List<Task>();
                trans.Commit();
            }

            if(listTasks != null && listTasks.Count > 0) project.ProductBacklog = listTasks;

            return project;
        }
예제 #7
0
        public void TestCreate()
        {
            // Arrange
            ProjectRepository repository = new ProjectRepository();
            Project p = new Project();
            p.Name = "Testprojekt für Unit-Test";
            User u = new User();
            u.Firstname = "Hans";
            u.Lastname = "Muster";
            u.Username = "******";
            u.EMail = "*****@*****.**";
            u.Password = "******";
            p.Owner = u;
            p.Members.Add(u);
            Task t1 = new Task();
            t1.Title = "Task 1";
            t1.Project = p;
            Task t2 = new Task();
            t2.Title = "Task 2";
            t2.Project = p;
            Task t3 = new Task();
            t3.Title = "Task 3";
            t3.Project = p;
            p.ProductBacklog.Add(t1);
            p.ProductBacklog.Add(t2);
            p.ProductBacklog.Add(t3);

            // Act
            repository.SaveOrUpdate(p);

            // Assert
            Project p2 = repository.GetProject(p.Id);
            p2 = repository.LoadProductBacklog(p2);
            Assert.IsNotNull(p2);
            Assert.AreEqual(p.Name, p2.Name);
            Assert.AreEqual(p2.Owner.Username, u.Username);
            Assert.AreEqual(1, p2.Members.Count);
            Assert.AreEqual(3, p2.ProductBacklog.Count);
        }
예제 #8
0
 public IList<Task> GetProductBacklogByProject(Project project)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public Sprint GetCurrentSprint(Project project)
 {
     return this.SprintRepository.GetCurrentSprint(project);
 }
예제 #10
0
 public IList<Sprint> GetSprintsByProject(Project project)
 {
     throw new NotImplementedException();
 }
예제 #11
0
        public Project LoadSprints(Project project)
        {
            if(project == null) throw new ArgumentNullException("project");

            IList<Sprint> listSprints;

            ISession session = PersistenceManager.CurrentSession;
            using(ITransaction trans = session.BeginTransaction())
            {
                listSprints = session.CreateQuery("FROM Sprint s WHERE s.Project = :sProject").SetEntity("sProject", project).List<Sprint>();
                trans.Commit();
            }

            if(listSprints != null && listSprints.Count > 0) project.Sprints = listSprints;

            return project;
        }