public void EngineThrowsOnFailingTests(string source, string offendingLine, string stackTrace, ScriptEngineProxy sut) { var script = new Script("<anonymous block>", source); var exception = Assert.Throws<ScriptException>(() => sut.Execute(new[] { script })); Assert.Equal(offendingLine, exception.OffendingLine); Assert.Equal(stackTrace, exception.JavaScriptStackTrace); }
public void EngineRunsAllScripts(ScriptEngineProxy sut) { var scripts = new[] { new Script("", "function test(x) { if (x) throw 'nonsense'; }"), new Script("", "test(true);"), }; Assert.Throws<ScriptException>(() => sut.Execute(scripts)); }
public void EngineDoesNotThrowOnPassingTests(string source, ScriptEngineProxy sut) { var script = new Script("", source); Assert.DoesNotThrow(() => sut.Execute(new[] { script })); }