Ejemplo n.º 1
0
        public void ScriptBlockIsImmutable(InlineScriptSource[] oldInlineScriptSources, InlineScriptSource newInlineScriptSource)
        {
            var old = new ScriptBlock(oldInlineScriptSources);
            var @new = old.AppendScript(newInlineScriptSource);

            Assert.NotSame(@new, old);
        }
        public void InlineScriptHasCorrectProperties(string scriptName, string scriptText)
        {
            var sut = new InlineScriptSource(scriptName, scriptText);

            Assert.Equal(scriptName, sut.Name);
            Assert.Equal(scriptText, sut.ScriptText);
        }
Ejemplo n.º 3
0
        public void ScriptBlockAppendsScript(InlineScriptSource[] oldInlineScriptSources, InlineScriptSource newInlineScriptSource)
        {
            var sut = new ScriptBlock(oldInlineScriptSources)
                .AppendScript(newInlineScriptSource);

            var expected = oldInlineScriptSources.Concat(new[] {newInlineScriptSource});

            Assert.Equal(expected, sut.Scripts);
        }
        public void ScriptRunnerCorrectlyConvertsMultipleScripts([Frozen] IScriptEngine engine, ScriptRunner sut, InlineScriptSource[] sources)
        {
            var scriptBlock = new ScriptBlock(sources);

            var expected = sources.Select(s => new Script(s.Name, s.ScriptText));

            sut.RunScripts(scriptBlock);

            Mock.Get(engine).Verify(x => x.Execute(It.Is<IEnumerable<Script>>(actual => actual.EnumerableEquals(expected))));
        }
Ejemplo n.º 5
0
 public void ScriptBlockSavesSuppliedScripts(InlineScriptSource[] inlineScriptSources)
 {
     var sut = new ScriptBlock(inlineScriptSources);
     Assert.Equal(inlineScriptSources, sut.Scripts);
 }
Ejemplo n.º 6
0
 void IScriptSourceVisitor.Visit(InlineScriptSource scriptSource)
 {
     _scripts.Add(new Script(scriptSource.Name, scriptSource.ScriptText));
 }