public IActionResult Random([Required] string numbers) { if (!ModelState.IsValid) { return(View(numbers)); } var list = new List <int>(); foreach (var n in numbers.Split(',', StringSplitOptions.RemoveEmptyEntries)) { if (int.TryParse(n, out var result)) { list.Add(result); } } Scientist.Enabled(() => DateTime.Now.Millisecond % 2 == 0); var resultSummary = Scientist.Science <Result>("Math", experiment => { experiment.Compare((x, y) => x.Largest == y.Largest && Math.Abs(x.Average - y.Average) < .5 && x.Smallest == y.Smallest && x.Sum == y.Sum); experiment.Use(() => OldApi.Math.Summary(list.ToArray())); experiment.Try(() => NewApi.Math.Summary(list.ToArray())); }); ViewData.Add("Result", ((ResultPublisher)Scientist.ResultPublisher).Result); return(View(resultSummary)); }
public HomeController() { ((ResultPublisher)Scientist.ResultPublisher).Result = null; Scientist.Enabled(() => true); }