public static void PerfectNumberShouldThrowEx(int number) { // Arrange // Assert Assert.Throws <ArgumentException>(() => Aliquot.AliquotSum(number)); }
public static void AliquotSumWork(int number, int expectedAS) { // Arrange // Act var result = Aliquot.AliquotSum(number); // Assert Assert.AreEqual(result, expectedAS); }
private void ReportProgress(Aliquot.Common.ProgressEventArgs args) { this.progressbar.Value = args.Percent; this.textboxDescription.Text = args.Message; }
private static void ReportProgress(Aliquot.Common.ProgressEventArgs args) { System.Console.Out.WriteLine(string.Format("{0}% complete: {1}", args.Percent, args.Message)); }
public IActionResult DodajanjeAlikvotov([FromForm] DodajanjeAlikvotovViewModel alikvot) { if (alikvot == null) { return(RedirectToAction("Index")); } if (alikvot.IdVzorca == null || alikvot.Box == null) { return(View(alikvot)); } Console.WriteLine(alikvot.IdVzorca); var originalSample = _dbContext.Samples.Include(m => m.NewId).First(m => m.NewId.ToString() == alikvot.IdVzorca); var startPosition = 0; var boxName = _dbContext.Boxes.First(m => m.BoxName == alikvot.Box); if (alikvot.Location != null) { var column = (int)char.GetNumericValue(alikvot.Location[1]); if (alikvot.Location.Length == 3) { column = 10 * column + (int)char.GetNumericValue(alikvot.Location[2]); } startPosition = _rowNames[alikvot.Location[0]] * boxName.Size + column; } for (var i = 0; i < alikvot.StAlikvotov; i++) { var id = new SampleId { AliquotSequenceNumber = originalSample.NewId.AliquotSequenceNumber, IsolateType = originalSample.NewId.IsolateType, ProcessedAliquotSequenceNumber = originalSample.NewId.ProcessedAliquotSequenceNumber, ProcessedIsolateType = originalSample.NewId.ProcessedIsolateType, SequenceNumber = originalSample.NewId.SequenceNumber, Year = originalSample.NewId.Year }; if (id.AliquotSequenceNumber == 0) { id.AliquotSequenceNumber = i + 1; } else { id.ProcessedAliquotSequenceNumber = i + 1; } if (!alikvot.Volume.HasValue) { return(View(alikvot)); } var sample = new Aliquot { Volume = alikvot.VolType == "ml" ? alikvot.Volume.Value : alikvot.Volume.Value / 1000000, AliquotationDate = alikvot.Date ?? DateTime.Now, OriginalSample = originalSample, NewId = id }; if (alikvot.Project != null) { sample.ProjectName = _dbContext.Projects.FirstOrDefault(m => m.Name == alikvot.Project); } if (alikvot.Notes != null) { sample.Comments = alikvot.Notes; } if (!alikvot.Razdelek.HasValue) { return(View(alikvot)); } var stored = new Storage { FridgeName = _dbContext.Fridges.FirstOrDefault(m => m.Name == alikvot.Fridge), Temperature = alikvot.Temp, Section = alikvot.Razdelek.Value, BoxName = boxName, Position = startPosition + i }; sample.Stored = stored; _dbContext.Samples.Add(sample); } _dbContext.SaveChanges(); return(RedirectToAction("Index")); }