예제 #1
0
        private void DoSetTasksData(string input)
        {
            //studentId courseId taskName//score
            var parts     = ReadHelper.SplitInput(input, 4, _inputDelimiter);
            var studentId = ReadHelper.ParseIntSave(parts[0], "StudentId");
            var student   = GetStudentById(studentId);
            var courseId  = ReadHelper.ParseIntSave(parts[1], "CourseId");

            if (student.CourseId != courseId)
            {
                // TODO custom exception
                throw new InvalidOperationException($"Student with id: {studentId} is not sign to course with id: {courseId}");
            }

            student.AddTask(new Task(parts[2], ReadHelper.ParseFloatSave(parts[3], "Task Id")));
        }