public void View_Past_Project(object sender, RoutedEventArgs e) { Project selected_project = (Project)Past_Projects_Listbox.SelectedItem; this.project_to_display = selected_project; Single_Project_Container.DataContext = this; int project_to_display_id = this.project_to_display.ProjectId; Notes = note_repo.GetAllByProjectId(project_to_display_id); Notes_Listbox.DataContext = Notes; Dependency_Listbox.DataContext = dependency_repo.GetAllByProjectId(project_to_display_id); Colors_Listbox.DataContext = color_repo.GetAllByProjectId(project_to_display_id); _show_view(Past_Projects_List, false); _show_view(Single_Project_Container, true); if (Colors_Listbox.Items.Count == 0) { _show_list(Colors_Listbox, false); } if (Notes_Listbox.Items.Count == 0) { _show_list(Notes_Listbox, false); } if (Dependency_Listbox.Items.Count == 0) { _show_list(Dependency_Listbox, false); } }
public void TestDependencysGetAllByProjectIdMethod() { int project_id = project_repo.All()[0].ProjectId; dependency_repo.Add(new Dependency("this is a test note", project_id)); dependency_repo.Add(new Dependency("this is a note 2", project_id)); var notes = dependency_repo.GetAllByProjectId(project_id); Assert.AreEqual(notes.Count, 2); int first_note_id = notes[0].DependencyId; int second_note_id = notes[1].DependencyId; Assert.AreEqual("this is a test note", dependency_repo.GetById(first_note_id).DependencyDetails); Assert.AreEqual("this is a note 2", dependency_repo.GetById(second_note_id).DependencyDetails); }