Exemplo n.º 1
0
        public static SolutionBuildResult ValidateSingleFileSolution(this ISolutionValidator validator, string userWrittenCode, string fullCodeFile)
        {
            string message;

            if ((message = validator.FindFullSourceError(userWrittenCode)) != null)
            {
                return(new SolutionBuildResult(fullCodeFile, message));
            }
            return(validator.ValidateSolution(userWrittenCode, fullCodeFile));
        }
Exemplo n.º 2
0
        public SolutionBuildResult BuildSolution(string usersExercise)
        {
            var    solution = ExerciseCode.Insert(IndexForInsert, usersExercise + "\r\n");
            string message;

            if ((message = Validator.FindFullSourceError(usersExercise)) != null)
            {
                return(SolutionBuildResult.Error(message, usersExercise));
            }
            if ((message = Validator.FindSyntaxError(solution)) != null)
            {
                return(SolutionBuildResult.Error(message, solution));
            }
            if ((message = Validator.FindValidatorError(usersExercise, solution)) != null)
            {
                return(SolutionBuildResult.StyleIssue(message, solution));
            }
            return(SolutionBuildResult.Success(solution));
        }