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 static SolutionBuildResult ValidateSolution(this ISolutionValidator validator, string userWrittenCode, string fullCodeFile) { string message; if ((message = validator.FindSyntaxError(fullCodeFile)) != null || (message = validator.FindStrictValidatorErrors(userWrittenCode, fullCodeFile)) != null) { return(new SolutionBuildResult(fullCodeFile, message)); } var styleErrors = validator.FindValidatorErrors(userWrittenCode, fullCodeFile); if (styleErrors.Any()) { return(new SolutionBuildResult(fullCodeFile, styleErrors: styleErrors)); } return(new SolutionBuildResult(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)); }