public async Task <IActionResult> CreateTestRunCustomArgumentAsync([FromBody] TestRunCustomArgumentDto testRunCustomArgumentDto)
        {
            if (testRunCustomArgumentDto == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var testRunCustomArgument = Mapper.Map <TestRunCustomArgument>(testRunCustomArgumentDto);

            var result = await _meissaRepository.InsertWithSaveAsync(testRunCustomArgument);

            var resultDto = Mapper.Map <TestRunCustomArgumentDto>(result);

            return(Ok(resultDto));
        }
Beispiel #2
0
 private async Task CreateTestRunCustomArgumentsAsync(Guid testRunId, IEnumerable <string> customArgumentsPairs)
 {
     // TODO: add a validation that it is correctly formatted?
     foreach (var customArgumentPair in customArgumentsPairs)
     {
         var customArgumentPairString = customArgumentPair.Split('=');
         if (customArgumentPairString.Length == 2)
         {
             string key   = customArgumentPairString[0];
             string value = customArgumentPairString[1];
             if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
             {
                 var testRunCustomArgumentDto = new TestRunCustomArgumentDto
                 {
                     Key       = key,
                     Value     = value,
                     TestRunId = testRunId,
                 };
                 await _testRunCustomArgumentRepository.CreateAsync(testRunCustomArgumentDto);
             }
         }
     }
 }