Exemplo n.º 1
0
        public bool test3() //search for professor (Britton Wolfe) while Software is written in regular search box; courseID's are 186, 187
        {
            Search     search = Search.Create("course_database.txt");
            CourseInfo DB     = CourseInfo.Create();

            search.options.clear();
            search.options.firstNameProfessor = "Britton";
            search.options.lastNameProfessor  = "Wolfe";
            search.searchForQuery("Software");
            search.advancedSearchFilter();

            if (search.lastSearchResults.getCourses().Count != 2)
            {
                return(false);
            }

            foreach (var course in search.lastSearchResults.getCourses())
            {
                int courseID = course.getCourseID();
                if (courseID != 186 && courseID != 187)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        //all tests are based on requirement 7 (professor searching) of the sprint 1 testing plan, tests b-d
        public bool test1() //searching for a specific professor (Britton Wolfe); courseIDs should be 184, 186, and 187.
        {
            Search     search = Search.Create("course_database.txt");
            CourseInfo DB     = CourseInfo.Create();

            search.options.clear();
            search.options.firstNameProfessor = "Britton";
            search.options.lastNameProfessor  = "Wolfe";
            search.searchForQuery(null);
            search.advancedSearchFilter();

            foreach (var course in search.lastSearchResults.getCourses())
            {
                int courseID = course.getCourseID();
                if (courseID != 184 && courseID != 186 && courseID != 187)
                {
                    return(false);
                }
            }

            if (search.lastSearchResults.getCourses().Count != 3)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public bool test2() //search database with nothing entered (all courses in database will be returned); course ID's are 0 through 760
        {
            Search     search = Search.Create("course_dictionary.txt");
            CourseInfo DB     = CourseInfo.Create();

            search.options.clear();
            search.options.firstNameProfessor = "";
            search.options.lastNameProfessor  = "";
            search.searchForQuery("");
            search.advancedSearchFilter();

            int i = 0;

            foreach (var course in search.lastSearchResults.getCourses())
            {
                if (i++ != course.getCourseID())
                {
                    return(false);
                }
            }
            if (i != DB.getNumCourses())
            {
                return(false);
            }
            if (i != 761)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
 //builds an empty candidate schedule
 private CandidateSchedule()
 {
     schedule    = new List <Course>();
     DB          = CourseInfo.Create();
     creditCount = 0;
     m_Courses   = new List <Calendar.Appointment>();
 }
Exemplo n.º 5
0
        // Constructor that uses a course id
        public Course(int courseID)
        {
            CourseInfo DB = CourseInfo.Create();

            this.courseID  = courseID;
            this.professor = DB.getProf(courseID);

            this.time = DB.getTime(courseID);
            this.day  = DB.getDay(courseID);

            this.building = DB.getBuilding(courseID);
            this.room     = DB.getRoom(courseID);

            this.courseDept = DB.getCourseDept(courseID);
            this.courseNum  = DB.getCourseNum(courseID);
            this.courseSect = DB.getCourseSect(courseID);
            this.courseCode = DB.getCourseCode(courseID);

            this.shortName = DB.getShortName(courseID);
            this.longName  = DB.getLongName(courseID);

            this.enrollment = DB.getEnrollment(courseID);
            this.capacity   = DB.getCapacity(courseID);

            this.credits = DB.getCredits(courseID);

            this.allInfo = DB.getAllInfo(courseID);
        }
Exemplo n.º 6
0
 public static CourseInfo Create(string db_filename, string rmp_filename)
 {
     if (singleton == null)
     {
         singleton = new CourseInfo(db_filename, rmp_filename);
     }
     return(singleton);
 }
Exemplo n.º 7
0
 public static CourseInfo Create()
 {
     if (singleton == null)
     {
         singleton = new CourseInfo();
     }
     return(singleton);
 }
Exemplo n.º 8
0
        // Adds all the courses to the search results
        private void addAllCourses()
        {
            lastSearchResults.relevance.Clear();  // Clear the results from the last search
            lastSearchResults.courses.Clear();    // Clear the results from the last search

            // Add all of the courses to the search results:
            for (int i = 0; i < CourseInfo.Create().getNumCourses(); i++)
            {
                lastSearchResults.courses.Add(new Course(i));
                lastSearchResults.relevance[i] = 1;
            }
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            CourseInfo database = CourseInfo.Create("course_database.txt", "rmp_database.txt");  // Creates CourseInfo singleton
            Search     search   = Search.Create("course_dictionary.txt");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ScheduleApp.AppWindow());

            UnitTests test = new UnitTests();

            // This code is for testing the course search and spell-checking features

            // Creates an instance of the Search class using course_dictionary.txt for spell-checking and mini course database
            //Search search = new Search("course_dictionary.txt");

            Console.WriteLine("Running Test 1...\n ");
            printSuccess(test.test1());
            Console.WriteLine("Running Test 2...\n ");
            printSuccess(test.test2());
            Console.WriteLine("Running Test 3...\n ");
            printSuccess(test.test3());
        }
Exemplo n.º 10
0
 //returns a list of courses that conflict with the course with the given id, including itself
 public List <Course> checkTimeConflict(int id)
 {
     return(checkTimeConflict(CourseInfo.Create().getCourse(id)));
 }