private void GetTestCaseInfo(TestCaseRequest request) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); try { RequestHandlers.SpeedUpStart(); char[] splitChars = { ',' }; int testCaseId = 0; Options_AZDO_TFS options = GetOptions(); foreach (string testCase in request.TestID.Split(splitChars, StringSplitOptions.None)) { if (int.TryParse(testCase, out testCaseId)) { CreateWS_TM_TestCaseInfo(testCaseId, request.TestSections, options); } AZDOHelper.ProcessLoopDelay(options); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { RequestHandlers.SpeedUpEnd(); } Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
public async Task <IActionResult> Post([FromBody] TestCaseRequest model) { TestCase newRecord = null; if (ModelState.IsValid) { InitUserCredentials(); newRecord = new TestCase { Guid = Guid.NewGuid(), UserGuid = UserGuid, CompanyGuid = CompanyGuid, CreationTime = DateTime.UtcNow, CreationUserGuid = UserGuid }; newRecord = _mapper.Map(model, newRecord); try { await _testCaseService.Save(newRecord); } catch (Exception e) { Log.Error(e.StackTrace); throw; } } return(CreatedAtAction(nameof(Post), _mapper.Map(newRecord, new TestCaseResponse()))); }
public async Task <TestCaseResponse> InsertAsync(TestCaseRequest testCaseRequest) { var testCase = testCaseRequest.ToDataModel(); await _dbService.InsertAsync(testCase); return(testCase.ToResponse()); }
public static TestCase ToDataModel(this TestCaseRequest r) { return(new TestCase() { AzureTestCaseId = r.AzureTestCaseId, TeamProject = r.TeamProject, Title = r.Title, ExtraData = r.ExtraData.ToDataModel() }); }
public async Task <Guid> AddTestCase(TestCaseRequest testCaseRequest) { if (testCaseRequest.AccountId == null) { throw new ArgumentNullException(nameof(testCaseRequest.AccountId)); } var testCase = new DataTestCaseRequest() { AccountId = testCaseRequest.AccountId, Title = testCaseRequest.Title }; var id = await _dataTestCaseService.AddTestCase(testCase); return(Guid.Parse(id)); }
public async Task <IActionResult> Put([FromBody] TestCaseRequest model, Guid guid) { if (ModelState.IsValid) { if (guid == Guid.Empty) { return(new BadRequestResult()); } var record = await _testCaseService.Get(guid); if (record == null) { return(new NoContentResult()); } InitUserCredentials(); if (record.UserGuid != UserGuid) { return(new UnauthorizedResult()); } var mapped = _mapper.Map(model, record); mapped.LastUpdateTime = DateTime.Now; mapped.LastUpdateUserGuid = UserGuid; try { await _testCaseService.Save(mapped); } catch (Exception e) { Log.Error(e.StackTrace); throw; } } return(new OkResult()); }
public async Task <TestCaseResponse> InsertTestCaseAsync(TestCaseRequest testCaseRequest) { return(await SendAsync <TestCaseResponse>(HttpMethod.Post, "testcases", testCaseRequest)); }
public async Task <Guid> AddTestCase([FromBody] TestCaseRequest testCaseRequest) { return(await _testCaseService.AddTestCase(testCaseRequest)); }