Beispiel #1
0
        public async Task <IActionResult> CreateTestResult(
            [FromBody] CreateTestResultCommand createTestResultCommandModel)
        {
            var commandResult = await _testResultCommandHandler.ExecuteAsync(createTestResultCommandModel);

            if (commandResult.Success)
            {
                return(CreatedAtAction(nameof(CreateTestResult), commandResult.Result));
            }

            return(BadRequest(createTestResultCommandModel));
        }
        private async Task <ICommandResult> CreateTestResults(Build build, BuildParseResult parseResult)
        {
            var testResultCommands = new List <CreateTestResultCommand>();

            foreach (var testResult in parseResult.TestResults)
            {
                var testResultCommand = new CreateTestResultCommand(
                    build.ProjectId, build.Id, testResult.Name, testResult.ClassName,
                    testResult.Duration, testResult.Status, testResult.Messages, testResult.StackTrace,
                    testResult.ErrorMessage);
                testResultCommands.Add(testResultCommand);
            }

            var addBatchTestResultCommand = new AddBatchTestResultCommand(testResultCommands);
            var testResultCommandResult   = await _testResultCommandHandler.ExecuteAsync(addBatchTestResultCommand);

            return(testResultCommandResult);
        }