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


C# TestContext.VerifyResult方法代码示例

本文整理汇总了C#中TestContext.VerifyResult方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.VerifyResult方法的具体用法?C# TestContext.VerifyResult怎么用?C# TestContext.VerifyResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestContext的用法示例。


在下文中一共展示了TestContext.VerifyResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestNavigationViaReducedExtensionMethodVB

        public void TestNavigationViaReducedExtensionMethodVB()
        {
            var metadata = @"Imports System.Runtime.CompilerServices
Namespace NS
    Public Module StringExtensions
        <Extension()>
        Public Sub M(ByVal o As String, x As Integer)
        End Sub
    End Module
End Namespace";
            var sourceWithSymbolReference = @"
Imports NS.StringExtensions
Public Module C
    Sub M()
        Dim s = ""Yay""
        s.[|M|](1)
    End Sub
End Module";
            var expected = [email protected]"#Region ""{FeaturesResources.Assembly} ReferencedAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null""
' {CodeAnalysisResources.InMemoryAssembly}
#End Region
Imports System.Runtime.CompilerServices

Namespace NS
    <Extension> 
    Public Module StringExtensions
        <Extension> Public Sub [|M|](o As String, x As Integer)
    End Module
End Namespace";

            using (var context = new TestContext(
                LanguageNames.VisualBasic,
                SpecializedCollections.SingletonEnumerable(metadata),
                includeXmlDocComments: false,
                sourceWithSymbolReference: sourceWithSymbolReference))
            {
                var navigationSymbol = context.GetNavigationSymbol();
                var metadataAsSourceFile = context.GenerateSource(navigationSymbol);
                context.VerifyResult(metadataAsSourceFile, expected);
            }
        }
开发者ID:nemec,项目名称:roslyn,代码行数:41,代码来源:MetadataAsSourceTests.cs

示例2: TestNavigationViaReducedExtensionMethodCS

        public void TestNavigationViaReducedExtensionMethodCS()
        {
            var metadata = @"using System;
public static class ObjectExtensions
{
    public static void M(this object o, int x) { }
}";
            var sourceWithSymbolReference = @"
class C
{
    void M()
    {
        new object().[|M|](5);
    }
}";
            var expected = [email protected]"#region {FeaturesResources.Assembly} ReferencedAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// {CodeAnalysisResources.InMemoryAssembly}
#endregion
 
public static class ObjectExtensions
{{
    public static void [|M|](this object o, int x);
}}
";

            using (var context = new TestContext(
                LanguageNames.CSharp,
                SpecializedCollections.SingletonEnumerable(metadata),
                includeXmlDocComments: false,
                sourceWithSymbolReference: sourceWithSymbolReference))
            {
                var navigationSymbol = context.GetNavigationSymbol();
                var metadataAsSourceFile = context.GenerateSource(navigationSymbol);
                context.VerifyResult(metadataAsSourceFile, expected);
            }
        }
开发者ID:nemec,项目名称:roslyn,代码行数:36,代码来源:MetadataAsSourceTests.cs


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