コード例 #1
0
        public void MapCourseProjectionToGeneralSelectionItem_WhenPassedValidProjectionModelID_ReturnsValidSelectionItemID()
        {
            var projection = new CourseCodeSubjectNameProjection {
                CourseCodeWithSubjectName = "Name", CourseID = Guid.NewGuid().ToString()
            };
            var mapped = MapCourse.MapCourseProjectionToGeneralSelectionItem(projection);

            Assert.True(Guid.TryParse(mapped.ID, out Guid result));
        }
コード例 #2
0
        public IEnumerable <GeneralSelectionItem> GetAllLabourCoursesWithSubjectStudentEnrolledToCurrentSemester(string userID)
        {
            if (userID == null || !Guid.TryParse(userID, out Guid userGUID))
            {
                throw new ParameterException("UserID is invalid");
            }
            string currentSemester       = SemesterManager.GetCurrentSemester();
            var    subjects              = _courseRepository.FindLabourCoursesWithSubjectStudentCurrentlyEnrolledTo(userID, currentSemester);
            var    subjectSelectionItems = subjects.Select(x => MapCourse.MapCourseProjectionToGeneralSelectionItem(x));

            return(subjectSelectionItems);
        }
コード例 #3
0
        public void MapCourseProjectionToGeneralSelectionItem_WhenPassedValidProjectionModel_ReturnsValidSelectionItem()
        {
            string name = "Name";
            string guid = Guid.NewGuid().ToString();

            var projection = new CourseCodeSubjectNameProjection {
                CourseCodeWithSubjectName = name, CourseID = guid
            };
            var mapped = MapCourse.MapCourseProjectionToGeneralSelectionItem(projection);

            Assert.Equal(name, mapped.DisplayName);
            Assert.Equal(guid, mapped.ID);
        }