private static RunHistory ProcessTestResults(IEnumerable <ValidationResponse> valCollection, int?groupId, int?projectId) { var runHistoryLog = new StringBuilder(); var runHistory = new RunHistory { GroupId = groupId, ProjectId = projectId, RunDateTime = DateTime.Now, RunHistoryDetails = new Collection <RunHistoryDetail>() }; foreach (var valResult in valCollection) { var runHistoryDetail = new RunHistoryDetail { TestId = valResult.TestId, RunDateTime = valResult.RunDateTime, IsValid = valResult.IsValid, Duration = valResult.Duration, ResultString = valResult.ResultMessage }; runHistoryLog.AppendLine(valResult.TestName); runHistoryLog.AppendLine(valResult.ResultMessage); runHistoryLog.AppendLine(valResult.RunLog); runHistory.RunHistoryDetails.Add(runHistoryDetail); } runHistory.RunLog = runHistoryLog.ToString(); return(runHistory); }
public void Update_Should_Update_A_RunHistory() { _repository .Setup(it => it.Update(It.IsAny <Int32>(), It.IsAny <DateTime>(), It.IsAny <Boolean>(), It.IsAny <String>(), It.IsAny <String>(), It.IsAny <Int64>())) .Callback <Int32, DateTime, Boolean, String, String, Int64>((testId, runDateTime, isPass, runLog, resultString, id) => { var tRunHistory = _repositoryList.Find(x => x.Id == id); tRunHistory.TestId = testId; tRunHistory.RunDateTime = runDateTime; tRunHistory.IsPass = isPass; tRunHistory.RunLog = runLog; tRunHistory.ResultString = resultString; }); var tempRunHistory = _repositoryList.Find(x => x.Id == id); var testRunHistory = new RunHistory { Id = tempRunHistory.Id, TestId = tempRunHistory.TestId, RunDateTime = tempRunHistory.RunDateTime, IsPass = tempRunHistory.IsPass, RunLog = tempRunHistory.RunLog, ResultString = tempRunHistory.ResultString }; //TODO change something on testRunHistory //testRunHistory.oldValue = newValue; _target.Update(testRunHistory); //Assert.AreEqual(newValue, _repositoryList.Find(x => x.Id==1).oldValue); //TODO fail until we update the test above Assert.Fail(); }
public ActionResult DeleteConfirmed(int id) { RunHistory runHistory = db.RunHistorySet.Find(id); db.RunHistorySet.Remove(runHistory); db.SaveChanges(); return(RedirectToAction("Index")); }
public static RunHistory IncludeRunHistoryDetail(this RunHistory runHistory, IRunHistoryDetailRepository RunHistoryDetailRepository) { if (runHistory.RunHistoryDetails != null) { return(runHistory); } runHistory.RunHistoryDetails = (RunHistoryDetailList)RunHistoryDetailRepository.GetDataByRunHistoryId(runHistory.Id); return(runHistory); }
public ActionResult Edit([Bind(Include = "Id,Date,Result,RulesId,RuleRevision,Message")] RunHistory runHistory) { if (ModelState.IsValid) { db.Entry(runHistory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RulesId = new SelectList(db.RulesSet, "Id", "Title", runHistory.RulesId); return(View(runHistory)); }
public static RunHistory IncludeTest(this RunHistory runHistory, ITestRepository testRepository) { if (runHistory.Test != null) { return(runHistory); } if (runHistory.TestId != null) { runHistory.Test = testRepository.GetDataById((int)runHistory.TestId).ToList().First(); } return(runHistory); }
public ActionResult Create(RunHistory runHistory) { try { _dbRunHistoryRepository.Insert(runHistory); return(RedirectToAction("Index")); } catch { return(View(runHistory)); } }
public ActionResult Edit(long id, RunHistory runHistory) { try { _dbRunHistoryRepository.Update(runHistory); return(RedirectToAction("Index")); } catch { return(View(runHistory)); } }
public ActionResult Create(RunHistory runHistory) { try { _dbRunHistoryRepository.Insert(runHistory); return RedirectToAction("Index"); } catch { return View(runHistory); } }
public ActionResult Edit(long id, RunHistory runHistory) { try { _dbRunHistoryRepository.Update(runHistory); return RedirectToAction("Index"); } catch { return View(runHistory); } }
public JobDataSource(SyncSide syncSide, DataSource dataSource, RunHistory history) { if (dataSource == null) { throw new Exception("Data source can not be null."); } DataSource = dataSource; SyncSide = syncSide; History = history; }
public void Update(int? testId, int? projectId, int? groupId, int? connectionId, DateTime runDateTime, decimal? totalDuration, bool isValid, string runLog, long id) { using (var client = new HttpClient(_messageHandler)) { client.BaseAddress = new Uri(_baseAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var runHistory = new RunHistory(id, testId, projectId, groupId, connectionId, runDateTime, totalDuration, isValid, runLog); var response = client.PutAsync(UrlBase, runHistory, new JsonMediaTypeFormatter()).Result; response.EnsureSuccessStatusCode(); } }
// GET: RunHistories/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RunHistory runHistory = db.RunHistorySet.Find(id); if (runHistory == null) { return(HttpNotFound()); } return(View(runHistory)); }
public void Update(int?testId, int?projectId, int?groupId, int?connectionId, DateTime runDateTime, decimal?totalDuration, bool isValid, string runLog, long id) { using (var client = new HttpClient(_messageHandler)) { client.BaseAddress = new Uri(_baseAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var runHistory = new RunHistory(id, testId, projectId, groupId, connectionId, runDateTime, totalDuration, isValid, runLog); var response = client.PutAsync(UrlBase, runHistory, new JsonMediaTypeFormatter()).Result; response.EnsureSuccessStatusCode(); } }
// GET: RunHistories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RunHistory runHistory = db.RunHistorySet.Find(id); if (runHistory == null) { return(HttpNotFound()); } ViewBag.RulesId = new SelectList(db.RulesSet, "Id", "Title", runHistory.RulesId); return(View(runHistory)); }
public void Test_RunHistory_Constructor_PostedTweetsShouldContain3Items() { DateTime dt = DateTime.UtcNow; XElement root = new XElement("PullRequests"); root.SetAttributeValue("lastrun", dt); root.Add(new XElement("PullRequest", "1")); root.Add(new XElement("PullRequest", "2")); root.Add(new XElement("PullRequest", "3")); XDocument doc = new XDocument(); doc.Add(root); var runHistory = new RunHistory(doc); Assert.AreEqual(3, runHistory.PostedTweets.Count); Assert.AreEqual(dt, runHistory.LastRun); }
public void Delete(RunHistory runHistory) { Delete(runHistory.Id); }
public long Insert(RunHistory runHistory) { return Insert(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, runHistory.RunDateTime, runHistory.TotalDuration, runHistory.IsValid, runHistory.RunLog); }
private void tsmStatistic_Click(object sender, EventArgs e) { RunHistory runHistory = new RunHistory(); runHistory.ShowDialog(); }
public long Insert(RunHistory runHistory) { return(Insert(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, runHistory.RunDateTime, runHistory.TotalDuration, runHistory.IsValid, runHistory.RunLog)); }
public void Update(RunHistory runHistory) { _dbRepository.Update(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, (DateTime)runHistory.RunDateTime, runHistory.TotalDuration, (bool)runHistory.IsValid, runHistory.RunLog, runHistory.Id); }
public void Update(RunHistory runHistory) { _dbRepository.Update(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, (DateTime)runHistory.RunDateTime, runHistory.TotalDuration, (bool)runHistory.IsValid, runHistory.RunLog, runHistory.Id); }
public void Delete(RunHistory runHistory) { Delete(runHistory.Id); }
public void Update_Should_Update_A_RunHistory() { _repository .Setup(it => it.Update(It.IsAny<Int32>(), It.IsAny<DateTime>(), It.IsAny<Boolean>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<Int64>())) .Callback<Int32, DateTime, Boolean, String, String, Int64>((testId, runDateTime, isPass, runLog, resultString, id) => { var tRunHistory = _repositoryList.Find(x => x.Id==id); tRunHistory.TestId = testId; tRunHistory.RunDateTime = runDateTime; tRunHistory.IsPass = isPass; tRunHistory.RunLog = runLog; tRunHistory.ResultString = resultString; }); var tempRunHistory = _repositoryList.Find(x => x.Id==id); var testRunHistory = new RunHistory { Id = tempRunHistory.Id, TestId = tempRunHistory.TestId, RunDateTime = tempRunHistory.RunDateTime, IsPass = tempRunHistory.IsPass, RunLog = tempRunHistory.RunLog, ResultString = tempRunHistory.ResultString}; //TODO change something on testRunHistory //testRunHistory.oldValue = newValue; _target.Update(testRunHistory); //Assert.AreEqual(newValue, _repositoryList.Find(x => x.Id==1).oldValue); //TODO fail until we update the test above Assert.Fail(); }
private static RunHistory ProcessTestResults(IEnumerable<ValidationResponse> valCollection, int? groupId, int? projectId) { var runHistoryLog = new StringBuilder(); var runHistory = new RunHistory { GroupId = groupId, ProjectId = projectId, RunDateTime = DateTime.Now, RunHistoryDetails = new Collection<RunHistoryDetail>() }; foreach (var valResult in valCollection) { var runHistoryDetail = new RunHistoryDetail { TestId = valResult.TestId, RunDateTime = valResult.RunDateTime, IsValid = valResult.IsValid, Duration = valResult.Duration, ResultString = valResult.ResultMessage }; runHistoryLog.AppendLine(valResult.TestName); runHistoryLog.AppendLine(valResult.ResultMessage); runHistoryLog.AppendLine(valResult.RunLog); runHistory.RunHistoryDetails.Add(runHistoryDetail); } runHistory.RunLog = runHistoryLog.ToString(); return runHistory; }
// Calculates and returns the penalty score based on state of this QR code's current modules. // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score. private int GetPenaltyScore() { int result = 0; RunHistory runHistory = new RunHistory(); // Adjacent modules in row having same color, and finder-like patterns int index = 0; for (int y = 0; y < Size; y++) { runHistory.Reset(); bool color = false; int runX = 0; for (int x = 0; x < Size; x++) { if (_modules[index] == color) { runX++; if (runX == 5) { result += PenaltyN1; } else if (runX > 5) { result++; } } else { runHistory.Add(runX); if (!color && runHistory.HasFinderLikePattern()) { result += PenaltyN3; } color = _modules[index]; runX = 1; } index++; } runHistory.Add(runX); if (color) { runHistory.Add(0); // Dummy run of white } if (runHistory.HasFinderLikePattern()) { result += PenaltyN3; } } // Adjacent modules in column having same color, and finder-like patterns for (int x = 0; x < Size; x++) { index = x; runHistory.Reset(); bool color = false; int runY = 0; for (int y = 0; y < Size; y++) { if (_modules[index] == color) { runY++; if (runY == 5) { result += PenaltyN1; } else if (runY > 5) { result++; } } else { runHistory.Add(runY); if (!color && runHistory.HasFinderLikePattern()) { result += PenaltyN3; } color = _modules[index]; runY = 1; } index += Size; } runHistory.Add(runY); if (color) { runHistory.Add(0); // Dummy run of white } if (runHistory.HasFinderLikePattern()) { result += PenaltyN3; } } // 2*2 blocks of modules having same color index = 0; for (int y = 0; y < Size - 1; y++) { for (int x = 0; x < Size - 1; x++) { bool color = _modules[index]; if (color == _modules[index + 1] && color == _modules[index + Size] && color == _modules[index + Size + 1]) { result += PenaltyN2; } index++; } index++; } // Balance of black and white modules int black = 0; index = 0; for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) { if (_modules[index]) { black++; } index++; } } int total = Size * Size; // Note that size is odd, so black/total != 1/2 // Compute the smallest integer k >= 0 such that (45-5k)% <= black/total <= (55+5k)% int k = (Math.Abs(black * 20 - total * 10) + total - 1) / total - 1; result += k * PenaltyN4; return(result); }
public void Update(RunHistory runHistory) { Update(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, runHistory.RunDateTime, runHistory.TotalDuration, runHistory.IsValid, runHistory.RunLog, runHistory.Id); }
public void Update(RunHistory runHistory) { Update(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, runHistory.RunDateTime, runHistory.TotalDuration, runHistory.IsValid, runHistory.RunLog, runHistory.Id); }
public Int64 Insert(RunHistory runHistory) { return(_dbRepository.Insert(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, (DateTime)runHistory.RunDateTime, runHistory.TotalDuration, (bool)runHistory.IsValid, runHistory.RunLog)); }
public Int64 Insert(RunHistory runHistory) { return _dbRepository.Insert(runHistory.TestId, runHistory.ProjectId, runHistory.GroupId, runHistory.ConnectionId, (DateTime)runHistory.RunDateTime, runHistory.TotalDuration, (bool)runHistory.IsValid, runHistory.RunLog); }