public void CanImplicitlyConvertToString() { var scriptBlock = new ScriptBlock("function myFunction() { }"); String script = scriptBlock; Assert.Equal(scriptBlock.ToScriptFragment(), script); }
public void WrapScriptBlockWithScriptTag() { var scriptBlock = new ScriptBlock("function myFunction() { }"); Assert.Equal( String.Format(ScriptResources.ScriptBlockFormat, "function myFunction() { }"), scriptBlock.ToScriptFragment() ); }
public void AlwaysAppendBlockToExistingScript() { var block1 = new ScriptBlock("var x = 0;"); var block2 = new ScriptBlock("var y = 1;"); var block3 = new ScriptBlock("var z = 2;"); var script = new TestScript(); script.AppendBlock(block1); script.AppendBlock(block2); script.AppendBlock(block3); Assert.Equal(block1 + Environment.NewLine + block2 + Environment.NewLine + block3 + Environment.NewLine, script.ToString()); }
public void AppendBlock(ScriptBlock scriptBlock) { Verify.NotNull(scriptBlock, "scriptBlock"); _script.AppendLine(scriptBlock.ToScriptFragment()); }