コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public void EngineDoesNotThrowOnPassingTests(string source, ScriptEngineProxy sut)
 {
     var script = new Script("", source);
     Assert.DoesNotThrow(() => sut.Execute(new[] { script }));
 }