本文整理汇总了C#中CodeColorizer类的典型用法代码示例。如果您正苦于以下问题:C# CodeColorizer类的具体用法?C# CodeColorizer怎么用?C# CodeColorizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeColorizer类属于命名空间,在下文中一共展示了CodeColorizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WillStyleAMethodWithoutArguments
public void WillStyleAMethodWithoutArguments()
{
string source =
@"using System;
namespace TheNamespace
{
/* This is a comment */
public class TheClass
: TheBaseClass, Implements
{
public string AMethod()
{
return ""Hello World!"";
}
}
}";
string expected =
"<div style=\"color:Black;background-color:White;\"><pre>\r\n<span style=\"color:Blue;\">using</span> System;\r\n\r\n<span style=\"color:Blue;\">namespace</span> TheNamespace\r\n{\r\n <span style=\"color:Green;\">/* This is a comment */</span>\r\n <span style=\"color:Blue;\">public</span> <span style=\"color:Blue;\">class</span> TheClass\r\n : TheBaseClass, Implements\r\n {\r\n <span style=\"color:Blue;\">public</span> <span style=\"color:Blue;\">string</span> AMethod()\r\n {\r\n <span style=\"color:Blue;\">return</span> <span style=\"color:#A31515;\">"Hello World!"</span>;\r\n }\r\n }\r\n}\r\n</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.CSharp);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:25,代码来源:CSharpScenarioTest.cs
示例2: WillStyleTextPtrFunction
public void WillStyleTextPtrFunction()
{
string sourceText =
@"USE pubs
GO
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(logo)
FROM pub_info pr, publishers p
WHERE p.pub_id = pr.pub_id
AND p.pub_name = 'New Moon Books'
GO";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">USE</span> pubs
GO
<span style=""color:Blue;"">DECLARE</span> @ptrval <span style=""color:Blue;"">varbinary</span>(16)
<span style=""color:Blue;"">SELECT</span> @ptrval = <span style=""color:Blue;"">TEXTPTR</span>(logo)
<span style=""color:Blue;"">FROM</span> pub_info pr, publishers p
<span style=""color:Blue;"">WHERE</span> p.pub_id = pr.pub_id
<span style=""color:Blue;"">AND</span> p.pub_name = <span style=""color:#A31515;"">'New Moon Books'</span>
GO
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:27,代码来源:SqlTextAndImageFunctionsTests.cs
示例3: WillStyleElementsWithNamespace
public void WillStyleElementsWithNamespace()
{
string source =
@"<asp:DropDownList ID=""StateList"" runat=""server"">
<asp:ListItem>CA</asp:ListItem>
<asp:ListItem>IN</asp:ListItem>
<asp:ListItem>KS</asp:ListItem>
<asp:ListItem>MD</asp:ListItem>
<asp:ListItem>MI</asp:ListItem>
<asp:ListItem>OR</asp:ListItem>
<asp:ListItem>TN</asp:ListItem>
<asp:ListItem>UT</asp:ListItem>
</asp:DropDownList>";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">DropDownList</span> <span style=""color:Red;"">ID</span><span style=""color:Blue;"">=</span><span style=""color:Blue;"">"StateList"</span> <span style=""color:Red;"">runat</span><span style=""color:Blue;"">=</span><span style=""color:Blue;"">"server"</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>CA<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>IN<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>KS<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>MD<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>MI<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>OR<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>TN<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""><</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>UT<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">ListItem</span><span style=""color:Blue;"">></span>
<span style=""color:Blue;""></</span><span style=""color:#A31515;"">asp</span><span style=""color:Blue;"">:</span><span style=""color:#A31515;"">DropDownList</span><span style=""color:Blue;"">></span>
</pre></div>";
string actual = new CodeColorizer().Colorize(source, GetGrammar());
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:31,代码来源:AspxAcceptanceTests.cs
示例4: WillStyleColLengthFunction
public void WillStyleColLengthFunction()
{
string sourceText =
@"USE AdventureWorks;
GO
CREATE TABLE t1
(c1 varchar(40),
c2 nvarchar(40)
);
GO
SELECT COL_LENGTH('t1','c1')AS 'VarChar',
COL_LENGTH('t1','c2')AS 'NVarChar';
GO
DROP TABLE t1;";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">USE</span> AdventureWorks;
GO
<span style=""color:Blue;"">CREATE</span> <span style=""color:Blue;"">TABLE</span> t1
(c1 <span style=""color:Blue;"">varchar</span>(40),
c2 <span style=""color:Blue;"">nvarchar</span>(40)
);
GO
<span style=""color:Blue;"">SELECT</span> <span style=""color:Blue;"">COL_LENGTH</span>(<span style=""color:#A31515;"">'t1'</span>,<span style=""color:#A31515;"">'c1'</span>)<span style=""color:Blue;"">AS</span> <span style=""color:#A31515;"">'VarChar'</span>,
<span style=""color:Blue;"">COL_LENGTH</span>(<span style=""color:#A31515;"">'t1'</span>,<span style=""color:#A31515;"">'c2'</span>)<span style=""color:Blue;"">AS</span> <span style=""color:#A31515;"">'NVarChar'</span>;
GO
<span style=""color:Blue;"">DROP</span> <span style=""color:Blue;"">TABLE</span> t1;
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:33,代码来源:SqlMetadataFunctionsTests.cs
示例5: WillStyleKnownAttributeTargets
public void WillStyleKnownAttributeTargets()
{
string source =
@"[assembly: SomeAttribute]
[module: SomeAttribute]
[type: SomeAttribute]
[return: SomeAttribute]
[param: SomeAttribute]
[method: SomeAttribute]
[field: SomeAttribute]
[property: SomeAttribute]
[event: SomeAttribute]";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
[<span style=""color:Blue;"">assembly</span>: SomeAttribute]
[<span style=""color:Blue;"">module</span>: SomeAttribute]
[<span style=""color:Blue;"">type</span>: SomeAttribute]
[<span style=""color:Blue;"">return</span>: SomeAttribute]
[<span style=""color:Blue;"">param</span>: SomeAttribute]
[<span style=""color:Blue;"">method</span>: SomeAttribute]
[<span style=""color:Blue;"">field</span>: SomeAttribute]
[<span style=""color:Blue;"">property</span>: SomeAttribute]
[<span style=""color:Blue;"">event</span>: SomeAttribute]
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.CSharp);
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:29,代码来源:CSharpKeywordTests.cs
示例6: WillStyleHeaderWithKeywords
public void WillStyleHeaderWithKeywords()
{
string source = @"<%@ Application Language=""C#"" CodeBehind=""Global.asax.cs"" Inherits=""Microsoft.Foundation.Web.Global"" %><script runat=""server"">bool public false</script>";
string expected = "<div style=\"color:Black;background-color:White;\"><pre>\r\n<span style=\"background-color:Yellow;\"><%</span><span style=\"color:Blue;\">@</span> <span style=\"color:#A31515;\">Application</span> <span style=\"color:Red;\">Language</span><span style=\"color:Blue;\">=</span><span style=\"color:Blue;\">"C#"</span> <span style=\"color:Red;\">CodeBehind</span><span style=\"color:Blue;\">=</span><span style=\"color:Blue;\">"Global.asax.cs"</span> <span style=\"color:Red;\">Inherits</span><span style=\"color:Blue;\">=</span><span style=\"color:Blue;\">"Microsoft.Foundation.Web.Global"</span> <span style=\"background-color:Yellow;\">%></span><span style=\"color:Blue;\"><</span><span style=\"color:#A31515;\">script</span> <span style=\"color:Red;\">runat</span><span style=\"color:Blue;\">=</span><span style=\"color:Blue;\">"server"</span><span style=\"color:Blue;\">></span><span style=\"color:Blue;\">bool</span> <span style=\"color:Blue;\">public</span> <span style=\"color:Blue;\">false</span><span style=\"color:Blue;\"></</span><span style=\"color:#A31515;\">script</span><span style=\"color:Blue;\">></span>\r\n</pre></div>";
string actual = new CodeColorizer().Colorize(source, GetGrammar());
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:8,代码来源:AsaxAcceptanceTests.cs
示例7: WillNotStyleKeyword
public void WillNotStyleKeyword()
{
string source = "get bool false";
string expected = "<div style=\"color:Black;background-color:White;\"><pre>\r\nget bool false\r\n</pre></div>";
string actual = new CodeColorizer().Colorize(source, GetGrammar());
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:8,代码来源:AshxAcceptanceTests.cs
示例8: TransformWillStyleAttributeTarget
public void TransformWillStyleAttributeTarget()
{
string source =
@"[assembly: SomeAttribute]";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
[<span style=""color:Blue;"">assembly</span>: SomeAttribute]
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.CSharp);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:13,代码来源:CSharpScenarioTest.cs
示例9: WillNotStyleKeywordsPrecededByAtSign
public void WillNotStyleKeywordsPrecededByAtSign()
{
string source =
@"@size";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
@size
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:13,代码来源:SqlScenarioTests.cs
示例10: WillNotStyleKeywordInsideStraightBracesWithSpaceBeforeAndAfter
public void WillNotStyleKeywordInsideStraightBracesWithSpaceBeforeAndAfter()
{
string source =
@"[ SELECT ]";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
[ SELECT ]
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:13,代码来源:SqlScenarioTests.cs
示例11: GetColorizer
public CodeColorizer GetColorizer( string key )
{
if (SyntaxEngine == null)
{
lock(SyntaxEngine)
{
SyntaxEngine = config.Configure();
if (SyntaxEngine == null)
throw (new Exception("Could not create colorizer engine"));
}
}
return SyntaxEngine;
}
开发者ID:vanzheng,项目名称:CShareCodeSample,代码行数:14,代码来源:SingleInstanceRepository.cs
示例12: WillStyleASolitaryUsingStatement
public void WillStyleASolitaryUsingStatement()
{
string source =
@"using System;";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">using</span> System;
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.CSharp);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:14,代码来源:CSharpScenarioTest.cs
示例13: WillStyleDoctypeWithLineBreakInDoubleQuotedString
public void WillStyleDoctypeWithLineBreakInDoubleQuotedString()
{
string source =
@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML
1.1//EN"" ""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"">";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;""><!</span><span style=""color:#A31515;"">DOCTYPE</span> <span style=""color:Red;"">html</span> <span style=""color:Red;"">PUBLIC</span> <span style=""color:Blue;"">"-//W3C//DTD XHTML
1.1//EN"</span> <span style=""color:Blue;"">"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"</span><span style=""color:Blue;"">></span>
</pre></div>";
string actual = new CodeColorizer().Colorize(source, GetGrammar());
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:15,代码来源:AspxAcceptanceTests.cs
示例14: TransformWillStyleClassName
public void TransformWillStyleClassName()
{
string source =
@"public class ClassName
{";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">public</span> <span style=""color:Blue;"">class</span> ClassName
{
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.CSharp);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:15,代码来源:CSharpScenarioTest.cs
示例15: WillStyleAlterAssembly
public void WillStyleAlterAssembly()
{
string sourceText =
@"ALTER ASSEMBLY MyClass
ADD FILE FROM 'C:\MyClassProject\Class1.cs';";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">ALTER</span> <span style=""color:Blue;"">ASSEMBLY</span> MyClass
<span style=""color:Blue;"">ADD</span> <span style=""color:Blue;"">FILE</span> <span style=""color:Blue;"">FROM</span> <span style=""color:#A31515;"">'C:\MyClassProject\Class1.cs'</span>;
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:15,代码来源:SqlClrTests.cs
示例16: WillStyleAlterTableStatement
public void WillStyleAlterTableStatement()
{
string source =
@"ALTER TABLE [TableName]
ADD [NewColumnName] VARCHAR(20) NOT NULL CONSTRAINT [ConstraintName] DEFAULT('DefaultValue');";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">ALTER</span> <span style=""color:Blue;"">TABLE</span> [TableName]
<span style=""color:Blue;"">ADD</span> [NewColumnName] <span style=""color:Blue;"">VARCHAR</span>(20) <span style=""color:Blue;"">NOT</span> <span style=""color:Blue;"">NULL</span> <span style=""color:Blue;"">CONSTRAINT</span> [ConstraintName] <span style=""color:Blue;"">DEFAULT</span>(<span style=""color:#A31515;"">'DefaultValue'</span>);
</pre></div>";
string actual = new CodeColorizer().Colorize(source, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:15,代码来源:SqlScenarioTests.cs
示例17: WillStyleTextsizeFunction
public void WillStyleTextsizeFunction()
{
string sourceText =
@"SELECT @@TEXTSIZE AS 'Regex Size'
SET TEXTSIZE 2048
SELECT @@TEXTSIZE AS 'Regex Size'";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">SELECT</span> @@TEXTSIZE <span style=""color:Blue;"">AS</span> <span style=""color:#A31515;"">'Regex Size'</span>
<span style=""color:Blue;"">SET</span> <span style=""color:Blue;"">TEXTSIZE</span> 2048
<span style=""color:Blue;"">SELECT</span> @@TEXTSIZE <span style=""color:Blue;"">AS</span> <span style=""color:#A31515;"">'Regex Size'</span>
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:17,代码来源:SqlConfiigurationFunctionsTests.cs
示例18: WillStyleCreateAggregate
public void WillStyleCreateAggregate()
{
string sourceText =
@"USE AdventureWorks;
GO
DECLARE @SamplesPath nvarchar(1024)
-- You may have to modify the value of the this variable if you have
--installed the sample some location other than the default location.
SELECT @SamplesPath = REPLACE(physical_name, 'Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf', 'Microsoft SQL Server\90\Samples\Engine\Programmability\CLR\')
FROM master.sys.database_files
WHERE name = 'master';
CREATE ASSEMBLY StringUtilities FROM @SamplesPath + 'StringUtilities\CS\StringUtilities\bin\debug\StringUtilities.dll'
WITH PERMISSION_SET=SAFE;
GO
CREATE AGGREGATE Concatenate(@input nvarchar(4000))
RETURNS nvarchar(4000)
EXTERNAL NAME [StringUtilities].[Microsoft.Samples.SqlServer.Concatenate];
GO";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">USE</span> AdventureWorks;
GO
<span style=""color:Blue;"">DECLARE</span> @SamplesPath <span style=""color:Blue;"">nvarchar</span>(1024)
<span style=""color:Green;"">-- You may have to modify the value of the this variable if you have</span>
<span style=""color:Green;"">--installed the sample some location other than the default location.</span>
<span style=""color:Blue;"">SELECT</span> @SamplesPath = <span style=""color:Magenta;"">REPLACE</span>(physical_name, <span style=""color:#A31515;"">'Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf'</span>, <span style=""color:#A31515;"">'Microsoft SQL Server\90\Samples\Engine\Programmability\CLR\'</span>)
<span style=""color:Blue;"">FROM</span> master.sys.database_files
<span style=""color:Blue;"">WHERE</span> <span style=""color:Blue;"">name</span> = <span style=""color:#A31515;"">'master'</span>;
<span style=""color:Blue;"">CREATE</span> <span style=""color:Blue;"">ASSEMBLY</span> StringUtilities <span style=""color:Blue;"">FROM</span> @SamplesPath + <span style=""color:#A31515;"">'StringUtilities\CS\StringUtilities\bin\debug\StringUtilities.dll'</span>
<span style=""color:Blue;"">WITH</span> PERMISSION_SET=SAFE;
GO
<span style=""color:Blue;"">CREATE</span> <span style=""color:Blue;"">AGGREGATE</span> Concatenate(@input <span style=""color:Blue;"">nvarchar</span>(4000))
<span style=""color:Blue;"">RETURNS</span> <span style=""color:Blue;"">nvarchar</span>(4000)
<span style=""color:Blue;"">EXTERNAL</span> <span style=""color:Blue;"">NAME</span> [StringUtilities].[Microsoft.Samples.SqlServer.Concatenate];
GO
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:43,代码来源:SqlClrTests.cs
示例19: WillStyleIsSrvrolememberFunction
public void WillStyleIsSrvrolememberFunction()
{
string sourceText =
@"IF IS_SRVROLEMEMBER ('sysadmin') = 1
print 'Current user''s login is a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') = 0
print 'Current user''s login is NOT a member of the sysadmin role'
ELSE IF IS_SRVROLEMEMBER ('sysadmin') IS NULL
print 'ERROR: The server role specified is not valid.'";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">IF</span> <span style=""color:Blue;"">IS_SRVROLEMEMBER</span> (<span style=""color:#A31515;"">'sysadmin'</span>) = 1
<span style=""color:Blue;"">print</span> <span style=""color:#A31515;"">'Current user'</span><span style=""color:#A31515;"">'s login is a member of the sysadmin role'</span>
<span style=""color:Blue;"">ELSE</span> <span style=""color:Blue;"">IF</span> <span style=""color:Blue;"">IS_SRVROLEMEMBER</span> (<span style=""color:#A31515;"">'sysadmin'</span>) = 0
<span style=""color:Blue;"">print</span> <span style=""color:#A31515;"">'Current user'</span><span style=""color:#A31515;"">'s login is NOT a member of the sysadmin role'</span>
<span style=""color:Blue;"">ELSE</span> <span style=""color:Blue;"">IF</span> <span style=""color:Blue;"">IS_SRVROLEMEMBER</span> (<span style=""color:#A31515;"">'sysadmin'</span>) <span style=""color:Blue;"">IS</span> <span style=""color:Blue;"">NULL</span>
<span style=""color:Blue;"">print</span> <span style=""color:#A31515;"">'ERROR: The server role specified is not valid.'</span>
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:RichardSlater,项目名称:ColorCodePortable,代码行数:23,代码来源:SqlSecurityFunctionsTests.cs
示例20: WillStylePatIndexFunction
public void WillStylePatIndexFunction()
{
string sourceText =
@"USE AdventureWorks;
GO
SELECT PATINDEX('%ensure%',DocumentSummary)
FROM Production.Document
WHERE DocumentID = 3;
GO";
string expected =
@"<div style=""color:Black;background-color:White;""><pre>
<span style=""color:Blue;"">USE</span> AdventureWorks;
GO
<span style=""color:Blue;"">SELECT</span> <span style=""color:Magenta;"">PATINDEX</span>(<span style=""color:#A31515;"">'%ensure%'</span>,DocumentSummary)
<span style=""color:Blue;"">FROM</span> Production.Document
<span style=""color:Blue;"">WHERE</span> DocumentID = 3;
GO
</pre></div>";
string actual = new CodeColorizer().Colorize(sourceText, Languages.Sql);
Assert.Equal(expected, actual);
}
开发者ID:cpancake,项目名称:ColorCode,代码行数:23,代码来源:SqlTextAndImageFunctionsTests.cs
注:本文中的CodeColorizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论