public async Task Invalid_return_type_on_method_fails_to_execute(string methodName) { var cSource = new CancellationTokenSource(TimeSpan.FromSeconds(3)); string actualMethodName = null; var scriptEventResult = ScriptEventResult.Successful(); await Task.Run(() => { var sciterWindow = new SciterWindow() .CreateMainWindow(320, 240) .CenterWindow() .SetTitle(nameof(SciterGraphicsTests)); var host = new TestHost(sciterWindow); host.AttachEventHandler(() => new TestEventHandler( onScriptCallCallback: (element, info, args, result) => { actualMethodName = info.Name; scriptEventResult = result; sciterWindow?.Close(); })); var pageData = "<html><head><style></style>" + "<script type=\"text/tiscript\"> " + $"view.{methodName}();" + "</script>" + "</head></html>"; host.Window.LoadHtml(pageData); host.Window.Show(); TranslateAndDispatch(cSource.Token); }, cSource.Token); Assert.NotNull(actualMethodName); Assert.AreEqual(methodName, actualMethodName); Assert.IsFalse(scriptEventResult.IsSuccessful); Assert.IsNull(scriptEventResult.Value); Assert.IsFalse(cSource.IsCancellationRequested); }
public void TearDown() { _sciterWindow?.Close(); _sciterWindow?.Destroy(); }