Ejemplo n.º 1
0
        public void ComputerEngineeringPreReqShortTest()
        {
            // Constants for a pre-determined major/school combo
            const string COMPUTER_ENGINEERING_MAJOR = "1";
            const string UNIVERSITY_WA = "1";
            const string MAX_QUARTERS  = "15";

            // From my experience this seems to be a common schedule preference
            // set. Using this object as a concrete example to help debug and test.
            int schedId = PreferenceHelper.ProcessPreference(new CourseObject()
            {
                school     = UNIVERSITY_WA,
                credits    = "10",
                courses    = "10",
                major      = COMPUTER_ENGINEERING_MAJOR,
                quarters   = MAX_QUARTERS,
                enrollment = ((int)Constants.EnrollmentType.FullTime).ToString(),
                job        = ((int)Constants.JobType.Unemployed).ToString(),
                summer     = "N"
            }, true);

            // Check that a schedule has been been made
            Assert.AreNotEqual(0, schedId);

            // The first check should be that all the prereqs are satisfied in the schedule.
            string result = db.ExecuteToString(getFulfillQueryString(schedId));

            // This query will return 0 if all of the prereqs are met.
            Assert.AreEqual(0, Int32.Parse(result));

            result = db.ExecuteToString(getScheduleQueryString(schedId));
            Debug.WriteLine("THIS IS THE OUTPUT for ID" + schedId + " " + result);
        }
Ejemplo n.º 2
0
 private void GeneratePlan(List <CourseObject> courseObj, List <int> insertedList)
 {
     foreach (var courseObject in courseObj)
     {
         var insertedId = PreferenceHelper.ProcessPreference(courseObject, true);
         insertedId.Should().NotBe(0);
         insertedList.Add(insertedId);
     }
 }
 public string Post(CourseObject content)
 {
     try
     {
         int id = PreferenceHelper.ProcessPreference(content);
         return(id.ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }