Пример #1
0
        public async Task <CodeTestingResult> GetCodeQuality(TestingCode code)
        {
            var codeAnalyzer = _codeAnalyzerFactory.GetCodeAnalyzer(code);

            var codeAnalysisResult = await codeAnalyzer.Analyse(code);

            var codeTestingResult = new CodeTestingResult
            {
                CodeAnalysisResult = codeAnalysisResult
            };

            if (!codeAnalysisResult.IsSuccessful)
            {
                return(codeTestingResult);
            }

            var executableCode = _executableCodeFactory.GetExecutableCode(code);

            codeTestingResult.CodeExecutionResult = await _codeExecutor.ExecuteAsync(executableCode);

            codeTestingResult.Score = GetFinalScore(codeTestingResult, code.Language);

            return(codeTestingResult);
        }
        public async Task <CodeExecutionResult> ExecuteCodeAsync(TestingCode code)
        {
            var executableCode = _codeFactory.GetExecutableCode(code);

            return(await _codeExecutor.ExecuteAsync(executableCode));
        }