本文整理汇总了C#中System.Text.StringBuilder.ShouldBeCode方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.ShouldBeCode方法的具体用法?C# StringBuilder.ShouldBeCode怎么用?C# StringBuilder.ShouldBeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.ShouldBeCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeScript_with_a_string_an_int_and_and_int_arrayproperty
public void TypeScript_with_a_string_an_int_and_and_int_arrayproperty()
{
var result = new StringBuilder();
var io = new IntellisenseObject(new[]
{
new IntellisenseProperty(_stringType, "AString"),
new IntellisenseProperty(_int32Type, "AnInt"),
new IntellisenseProperty(_int32ArrayType, "AnIntArray") { Summary = "ASummary"},
new IntellisenseProperty(_simpleType, "TheSimple")
})
{
FullName = "Foo.Primitives",
Name = "Primitives",
Namespace = "server"
};
IntellisenseWriter.WriteTypeScript(new[] { io }, result);
result.ShouldBeCode(@"
declare module server {
interface Primitives {
aString: string;
anInt: number;
/** ASummary */
anIntArray: number[];
theSimple: server.Simple;
}
}");
}
示例2: JavaScript_with_a_string_an_int_and_and_int_arrayproperty
public void JavaScript_with_a_string_an_int_and_and_int_arrayproperty()
{
var result = new StringBuilder();
var io = new IntellisenseObject(new[]
{
new IntellisenseProperty(_stringType, "AString"),
new IntellisenseProperty(_int32Type, "AnInt"),
new IntellisenseProperty(_int32ArrayType, "AnIntArray") { Summary = "ASummary"},
new IntellisenseProperty(_simpleType, "TheSimple")
})
{
FullName = "Foo.Primitives",
Name = "Primitives",
Namespace = "server"
};
IntellisenseWriter.WriteJavaScript(new[] { io }, result);
result.ShouldBeCode(@"
var server = server || {};
/// <summary>The Primitives class as defined in Foo.Primitives</summary>
server.Primitives = function() {
/// <field name=""aString"" type=""String"">The AString property as defined in Foo.Primitives</field>
this.aString = '';
/// <field name=""anInt"" type=""Number"">The AnInt property as defined in Foo.Primitives</field>
this.anInt = 0;
/// <field name=""anIntArray"" type=""Number[]"">ASummary</field>
this.anIntArray = [];
/// <field name=""theSimple"" type=""Object"">The TheSimple property as defined in Foo.Primitives</field>
this.theSimple = { };
};");
}
示例3: TypeScript_with_on_string_property
public void TypeScript_with_on_string_property()
{
var result = new StringBuilder();
var io = new IntellisenseObject(new[]
{
new IntellisenseProperty(_stringType, "AString")
})
{
FullName = "Foo.Primitives",
Name = "Primitives",
Namespace = "server"
};
IntellisenseWriter.WriteTypeScript(new[] { io }, result);
result.ShouldBeCode(@"
declare module server {
interface Primitives {
aString: string;
}
}");
}
示例4: JavaScript_with_on_string_property
public void JavaScript_with_on_string_property()
{
var result = new StringBuilder();
var io = new IntellisenseObject(new[]
{
new IntellisenseProperty(_stringType, "AString")
})
{
FullName = "Foo.Primitives",
Name = "Primitives",
Namespace = "server"
};
IntellisenseWriter.WriteJavaScript(new[] { io }, result);
result.ShouldBeCode(@"
var server = server || {};
/// <summary>The Primitives class as defined in Foo.Primitives</summary>
server.Primitives = function() {
/// <field name=""aString"" type=""String"">The AString property as defined in Foo.Primitives</field>
this.aString = '';
};");
}
示例5: TypeScript_with_a_string_and_simple_dictionary_property
public void TypeScript_with_a_string_and_simple_dictionary_property()
{
var result = new StringBuilder();
var io = new IntellisenseObject(new[]
{
new IntellisenseProperty(_stringType, "AString"),
new IntellisenseProperty(_stringDictionary, "ADictionary")
})
{
FullName = "Foo",
Name = "Bar",
Namespace = "server"
};
IntellisenseWriter.WriteTypeScript(new[] { io }, result);
result.ShouldBeCode(@"
declare module server {
interface Bar {
aString: string;
aDictionary: { [index: string]: string };
}
}"
);
}