//-----------------------------------------------------End------------------------------------------------------------ //Test function to display tabular view of researcher's cumulative number of publications by year //-----------------------------------------------------Start---------------------------------------------------- public void TestPublicationsCount() { LoadResearcherDetails(currentResearcher); PublicationsController p = new PublicationsController(); p.TestPublicationsCount(currentResearcher); }
//-----------------------------------------------------------End--------------------------------------------------------------------- //----------------------------------Test to print all the researcher details and publications--------------------------- //----------------------------------------------------Full Test Start------------------------------------------------------------------------------ public void TestResearcherListByID(int id) { LoadResearcherDetails(new Researcher { ID = id }); Console.WriteLine("Name: {0} {1}\nTitle:{2}\nUnit: {3}\nCampus: {4}\nEmail: {5}\n" + "Photo: {6}\nCurrent job: {7}\nCommenced with institution: {8}\n" + "Commenced current position: {9}\nPrevious positions: \n", currentResearcher.GivenName, currentResearcher.FamilyName, currentResearcher.Title, currentResearcher.Unit, currentResearcher.Campus, currentResearcher.Email, currentResearcher.Photo, currentResearcher.GetCurrentJob().Title(), currentResearcher.GetEarliestJob().Start.ToString("dd/MM/yyyy"), currentResearcher.GetCurrentJob().Start.ToString("dd/MM/yyyy")); //Test to print all the positions of the researcher (not include student) foreach (Position pos in currentResearcher.positions) { if (pos.End != default) { Console.WriteLine(String.Format("{0}\t{1}\t{2}\n", pos.Start.ToString("dd/MM/yyyy"), pos.End.ToString("dd/MM/yyyy"), pos.Title())); } ; } Console.WriteLine("Tenure: {0}\tPublications: {1}\n", currentResearcher.Tenure().ToString("0.0"), currentResearcher.PublicationsCount()); //Staff information Console.WriteLine("More information: \n"); LoadStudentDetails(); if (currentResearcher.position.Level != EmploymentLevel.Student) { Staff staff = new Staff(currentResearcher) { students = students }; TestStaff(); DisplayNumberOfSupervisions(staff); } //Student information else { Student s = (from stu in students where stu.ID == currentResearcher.ID select stu).SingleOrDefault(); DisplayDegreeForStudent(s); DisplaySupervisorName(s, res); } //List of publication PublicationsController pc = new PublicationsController(); List <Publication> sortedPub = pc.SortPublicationList(currentResearcher); Console.WriteLine("Publication count:"); pc.TestPublicationsCount(currentResearcher); Console.WriteLine("{0,-10} {1}\n", "Year", "Title"); foreach (Publication pub in sortedPub) { Console.WriteLine("{0,-10} {1}\n", pub.Year, pub.Title); } Console.WriteLine("Publication details: \n"); pc.LoadPublicationsFor(currentResearcher); pc.TestPublicationDetails(currentResearcher); }