当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.ShouldBeCode方法代码示例

本文整理汇总了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;
}
}");
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:29,代码来源:IntellisenseWriteTypeScriptTests.cs

示例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 = { };
};");
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:32,代码来源:IntellisenseWriteJavaScriptsTests.cs

示例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;
    }
}");
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:22,代码来源:IntellisenseWriteTypeScriptTests.cs

示例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 = '';
};");
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:23,代码来源:IntellisenseWriteJavaScriptsTests.cs

示例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 };
                    }
                }"
            );
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:25,代码来源:IntellisenseWriteTypeScriptTests.cs


注:本文中的System.Text.StringBuilder.ShouldBeCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。