本文整理汇总了C#中Script.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Script.ToString方法的具体用法?C# Script.ToString怎么用?C# Script.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Script
的用法示例。
在下文中一共展示了Script.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ErroneousScriptLoaderException
public ErroneousScriptLoaderException(Script script, AstNode entity, ElfExceptionType reason)
: base(reason)
{
Script = script;
Entity = entity;
Script.ToString();
}
示例2: ExpressionProducesLiterals
public void ExpressionProducesLiterals()
{
var l = (IEnumerable<Expression>)new List<Expression> { 1, 2, 3.14, "Test", true, null };
var s = new Script(l);
Assert.AreEqual("1;2;3.14;\"Test\";true;;", s.ToString());
}
示例3: ScriptProducesStatements
public void ScriptProducesStatements()
{
var a = JS.Id("a");
Script script1 = new Script
{
JS.Var(a),
{
JS.For(a.AssignWith(3), a.IsGreaterThan(0), a.PreDecrement())
.Do(JS.Alert(a)),
JS.Return(a)
}
};
Assert.AreEqual(3, script1.Statements.Count);
Assert.AreEqual("var a;for(a=3;a>0;--a)alert(a);return a;", script1.ToString());
Script script2 = new Script();
script2.Add(script1);
Assert.AreEqual("var a;for(a=3;a>0;--a)alert(a);return a;", script2.ToString());
}
示例4: Will_have_inline_content
public void Will_have_inline_content()
{
var script = new Script("foo=bar");
Assert.Contains(">foo=bar<", script.ToString());
}
示例5: Will_have_explicit_end_tag_and_no_content
public void Will_have_explicit_end_tag_and_no_content()
{
var script = new Script(new ReferencedFile { Path = "file.js" });
Assert.Contains("></script>", script.ToString());
}
示例6: OperatorAsFieldReference
private CodeFieldReferenceExpression OperatorAsFieldReference(Script.Operator op)
{
var field = new CodeFieldReferenceExpression();
field.TargetObject = new CodeTypeReferenceExpression(typeof(Script.Operator));
field.FieldName = op.ToString();
field.UserData.Add(RawData, op);
return field;
}
示例7: When_Getting_ToString_With_Script_Then_Script_Is_Wrapped_In_Xhtml_Compliant_Comments
public void When_Getting_ToString_With_Script_Then_Script_Is_Wrapped_In_Xhtml_Compliant_Comments()
{
var el = new Script {Code = "goose"};
Assert.That(el.ToString(), Text.Contains("/*<![CDATA[*/\r\ngoose\r\n//]]>"));
}
示例8: When_Getting_ToString_Then_Tag_Is_Generated
public void When_Getting_ToString_Then_Tag_Is_Generated()
{
var el = new Script();
Assert.That(el.ToString(), Text.Contains("<script"));
Assert.That(el.ToString(), Text.Contains("</script>"));
}