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); }
public ActionResult Edit(Project project) { if(this.ProjectService.EditProject(project, this.User.Identity.Name)) { return RedirectToAction("Show", new { id = project.Id }); } return View(project); }
public ActionResult Create(Project project) { if(this.ProjectService.CreateProject(project, this.User.Identity.Name)) { return RedirectToAction("Index"); } return View("Create"); }
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(); } }
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; }
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; }
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); }
public IList<Task> GetProductBacklogByProject(Project project) { throw new NotImplementedException(); }
public Sprint GetCurrentSprint(Project project) { return this.SprintRepository.GetCurrentSprint(project); }
public IList<Sprint> GetSprintsByProject(Project project) { throw new NotImplementedException(); }
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; }