private void CheckVsExpectation(long value, TestPerformanceKind context) { var expected = GetExpected(context); _Logger.Info($"Time expectation for the task: {expected}"); TimeSpan.FromMilliseconds(value).Should().BeLessThan(expected); }
public Task Test_HTMLBinding_Stress_Collection_CreateBinding(JavascriptBindingMode imode, TestPerformanceKind context, TestContext ipath = TestContext.Index) { int r = 100; var datacontext = new TwoList(); datacontext.L1.AddRange(Enumerable.Range(0, r).Select(i => new Skill())); var stopWatch = new Stopwatch(); stopWatch.Start(); var test = new TestInContext() { Path = ipath, Bind = (win) => HTML_Binding.Bind(win, datacontext, imode), Test = (mb) => { stopWatch.Stop(); var ts = stopWatch.ElapsedMilliseconds; _Logger.Info($"Perf: {((double) (ts)) / 1000} sec for {r} iterations"); var js = mb.JSRootObject; var col = GetSafe(() => GetCollectionAttribute(js, "L1")); col.GetArrayLength().Should().Be(r); CheckVsExpectation(ts, context); } }; return RunAsync(test); }
private Task Test_HTMLBinding_Stress_Collection_CreateBinding(JavascriptBindingMode imode, TestPerformanceKind context, TestContext ipath = TestContext.Index) { var r = 100; var datacontext = new TwoList(); datacontext.L1.AddRange(Enumerable.Range(0, r).Select(i => new Skill())); var stopWatch = new Stopwatch(); stopWatch.Start(); var test = new TestInContext() { Path = ipath, Bind = (win) => HtmlBinding.Bind(win, datacontext, imode), Test = (mb) => { stopWatch.Stop(); var ts = stopWatch.ElapsedMilliseconds; _Logger.Info($"Perf: {((double)(ts)) / 1000} sec for {r} iterations"); var js = mb.JsRootObject; var col = GetSafe(() => GetCollectionAttribute(js, "L1")); col.GetArrayLength().Should().Be(r); CheckVsExpectation(ts, context); } }; return(RunAsync(test)); }
private TimeSpan GetExpected(TestPerformanceKind context) { return(TimeSpan.FromMilliseconds(_ExpectedTimeInMilliSeconds[context])); }
private TimeSpan GetExpected(TestPerformanceKind context) { return TimeSpan.FromMilliseconds(_ExpectedTimeInMilliSeconds[context]); }