public async Task <ICommandResult <TestResult> > ExecuteAsync(CreateTestResultCommand command) { var testResult = await CreateTestResultAsync(command); await _testResultRepository.Add(testResult); return(new CommandResult <TestResult>(true, testResult)); }
private async Task <Test> GetTestAsync(CreateTestResultCommand command) { var createOrUpdateTestCommand = new CreateOrUpdateTestCommand(command.Name, command.ClassName, command.ProjectId); var createOrUpdateTestCommandResult = await _testCommandHandler.ExecuteAsync(createOrUpdateTestCommand); var test = createOrUpdateTestCommandResult.Result; return(test); }
private async Task <TestResult> CreateTestResultAsync(CreateTestResultCommand command) { var status = Enumeration.FromDisplayName <Status>(command.Status); var test = await GetTestAsync(command); var testResult = new TestResult { Id = Guid.NewGuid(), TestId = test.Id, BuildId = command.BuildId, Duration = command.Duration.Milliseconds, StatusId = status.Id, Messages = command.Messages, StackTrace = command.StackTrace, ErrorMessage = command.ErrorMessage }; return(testResult); }