public static SolutionBuildResult ValidateSolution(this ISolutionValidator validator, string userWrittenCode, string fullCodeFile) { string message; if ((message = validator.FindSyntaxError(fullCodeFile)) != null) { return(SolutionBuildResult.Error(message, fullCodeFile)); } if ((message = validator.FindValidatorError(userWrittenCode, fullCodeFile)) != null) { return(SolutionBuildResult.StyleIssue(message, fullCodeFile)); } return(SolutionBuildResult.Success(fullCodeFile)); }
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)); }