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