예제 #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 }));
 }