public async Task SendCommand(CommandMessage message) { // TODO check if sender can make call to reciver (browser engine) try { //TODO do case wgeb testrunhistory is null if (message.TestInfoId != null) { TestRunHistory testRunHistory = new TestRunHistory() { TestInfoId = message.TestInfoId.Value, SelectedBrowserEngine = message.ReceiverConnectionId, Configuration = JsonSerializer.Serialize(message.Configurations) }; _testRunHistoryRepository.Create(testRunHistory); _unitOfWork.SaveChanges(); message.TestRunHistoryId = testRunHistory.Id; } message.SenderConnectionId = Context.ConnectionId; await Clients.Client(message.ReceiverConnectionId).SendAsync("ReciveCommand", message); } catch (Exception ex) { //TODO log to db throw ex; } }
public ApplicationHistory RetrieveTestHistory(Guid applicationId) { ApplicationHistory result = new ApplicationHistory(); var application = dbContext.Applications.FirstOrDefault(a => a.ApplicationGuid == applicationId); if (application != null) { result = new ApplicationHistory() { Applicationid = applicationId, ApplicatioName = application.ApplicationName }; var tests = dbContext.Tests.Where(t => t.ApplicationId == application.ApplicationId).ToList(); var testRuns = (from tr in dbContext.TestRuns join t in dbContext.Tests on tr.TestId equals t.TestId where t.ApplicationId == application.ApplicationId select tr ).OrderByDescending(t => t.RunDate).ToList(); foreach (var test in tests) { TestHistory th = new TestHistory() { Comments = test.RollingComments, IsUnderDevelopment = test.CurrentStatus == ORMModel.Test.TestDefinitionStatusEnumeration.UnderDevelopment, TestDescription = test.Description, TestName = test.TestName, TestNumber = test.TestNumber, TestId = test.TestGuid, TestFamily = test.TestFamily, ETA = test.CurrentETA.HasValue ? test.CurrentETA.Value.ToString("MM/dd/yyyy") : test.OriginalETA.HasValue ? test.OriginalETA.Value.ToString("MM/dd/yyyy") : "" }; var runs = testRuns.Where(t => t.TestId == test.TestId); foreach (var run in runs) { TestRunHistory runHistory = new TestRunHistory() { BugReportLink = run.BugReportLink, RecordedBugDate = run.RecordedBugDate, TestReportLink = run.TestReportLink, Comments = run.Comments, DateRan = run.RunDate, RunStatus = run.RunStatus, TestRunId = run.TestRunGuid }; th.RunHistory.Add(runHistory); } result.Add(th); } } return(result); }
public TestRunHistoryViewModel(TestRunHistory testRunHistory) { Id = testRunHistory.Id; TestInfoId = testRunHistory.TestInfoId; TestInfoName = testRunHistory.TestInfo.Name; CreatedBy = testRunHistory.CreatedBy; DateAdded = testRunHistory.DateAdded; IsSuccesful = testRunHistory.TestRunResults.Count == 0 ?false : testRunHistory.TestRunResults.Last().IsSuccesful; }
public void UpdateTestRunHistory(TestRunHistory historyItem) { var existingItem = dbContext.TestRuns.FirstOrDefault(r => r.TestRunGuid == historyItem.TestRunId); if (existingItem != null) { existingItem.Comments = historyItem.Comments; existingItem.BugReportLink = historyItem.BugReportLink; existingItem.TimeToRun = historyItem.TimeToRun; if (!string.IsNullOrEmpty(historyItem.BugReportLink) && existingItem.RecordedBugDate.HasValue == false) { existingItem.RecordedBugDate = DateTime.Now; } dbContext.SaveChanges(); } }
public void UpdateTestRunHistory(TestRunHistory historyItem) { testManager.UpdateTestRunHistory(historyItem); }