private static List <OpleidingsplanGenerator.Models.Course> ConvertCourses(IEnumerable <Integration.Course> courses, CourseProfile profile, Collection <RestEducationPlanCourse> restCourses) { _logger.Debug("ConvertCourses"); List <OpleidingsplanGenerator.Models.Course> coursesToPlan = new List <OpleidingsplanGenerator.Models.Course>(); foreach (var course in courses) { OpleidingsplanGenerator.Models.Course courseToPlan = Mapper.Map <OpleidingsplanGenerator.Models.Course>(course); if (profile != null) { CoursePriority coursePriority = profile.Courses.FirstOrDefault(profileCourse => profileCourse.Code == course.Code); if (coursePriority != null) { courseToPlan.Priority = coursePriority.Priority; } } RestEducationPlanCourse restCourse = restCourses.FirstOrDefault(profileCourse => profileCourse.Code == course.Code); if (restCourse != null && restCourse.Priority != 0) { courseToPlan.Priority = restCourse.Priority; } coursesToPlan.Add(courseToPlan); } return(coursesToPlan); }
private void TestCourseWithDummyData(Integration.Course expected, OpleidingsplanGenerator.Models.Course actual) { Assert.AreEqual(expected.Code, actual.Code); Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Duration, actual.Duration); Assert.AreEqual(expected.ShortDescription, actual.ShortDescription); Assert.AreEqual(expected.SupplierName, actual.SupplierName); for (int i = 0; i < expected.CourseImplementations.Count; i++) { Assert.AreEqual(expected.CourseImplementations[i].Location, actual.CourseImplementations.ToArray()[i].Location); for (int a = 0; a < expected.CourseImplementations[i].Days.Count; a++) { Assert.AreEqual(expected.CourseImplementations[i].Days[a], actual.CourseImplementations.ToArray()[i].Days.ToArray()[a]); } } }