10 instantiations of CSharpTestSource
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
CSharpTestSource.cs (10)
25public static CSharpTestSource None => new CSharpTestSource(null); 78public static implicit operator CSharpTestSource(string source) => new CSharpTestSource(source); 79public static implicit operator CSharpTestSource(string[] source) => new CSharpTestSource(source); 80public static implicit operator CSharpTestSource((string Source, string FileName) source) => new CSharpTestSource(source); 81public static implicit operator CSharpTestSource((string Source, string FileName)[] source) => new CSharpTestSource(source); 82public static implicit operator CSharpTestSource(SyntaxTree source) => new CSharpTestSource(source); 83public static implicit operator CSharpTestSource(SyntaxTree[] source) => new CSharpTestSource(source); 84public static implicit operator CSharpTestSource(List<SyntaxTree> source) => new CSharpTestSource(source.ToArray()); 85public static implicit operator CSharpTestSource(ImmutableArray<SyntaxTree> source) => new CSharpTestSource(source.ToArray()); 86public static implicit operator CSharpTestSource(CSharpTestSource[] source) => new CSharpTestSource(source);
208 references to CSharpTestSource
Microsoft.CodeAnalysis.CSharp.CSharp15.UnitTests (2)
UnsafeEvolutionTests.cs (2)
2616CSharpTestSource source = 9263CSharpTestSource source =
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (10)
CodeGen\CodeGenAsyncEHTests.cs (1)
4731CSharpTestSource sources = [source, AsyncStreamsTypes];
CodeGen\CodeGenAsyncIteratorTests.cs (2)
143=> CreateCompilationWithTasksExtensions(new[] { (CSharpTestSource)CSharpTestBase.Parse(source, filename: "source", parseOptions), CSharpTestBase.Parse(AsyncStreamsTypes, filename: "AsyncStreamsTypes", parseOptions) }, 146private CSharpCompilation CreateCompilationWithAsyncIterator(CSharpTestSource source, CSharpCompilationOptions options = null, CSharpParseOptions parseOptions = null)
CodeGen\CodeGenAwaitForeachTests.cs (3)
2574CSharpTestSource sources = [source, AsyncStreamsTypes]; 3583CSharpTestSource sources = [source, AsyncStreamsTypes]; 3960CSharpTestSource sources = [source, AsyncStreamsTypes];
CodeGen\CodeGenExprLambdaTests.cs (1)
21CSharpTestSource source,
CodeGen\CodeGenFunctionPointersTests.cs (3)
29CSharpTestSource sources, 46private static CSharpCompilation CreateCompilationWithFunctionPointers(CSharpTestSource source, IEnumerable<MetadataReference>? references = null, CSharpCompilationOptions? options = null, TargetFramework? targetFramework = null) 51private static CSharpCompilation CreateCompilationWithFunctionPointers(CSharpTestSource source, bool includeUnmanagedCallersOnly, CSharpCompilationOptions? options = null)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Emit\EditAndContinue\EditAndContinueTestBase.cs (1)
272internal static CSharpCompilation WithSource(this CSharpCompilation compilation, CSharpTestSource newSource)
Emit\NumericIntPtrTests.cs (1)
11633CompilationVerifier compileAndVerify(CSharpTestSource source)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (17)
Attributes\AttributeTests_NullablePublicOnly.cs (7)
33CSharpTestSource sources = new[] { NullablePublicOnlyAttributeDefinition, source }; 218CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, source }; 272CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, NullablePublicOnlyAttributeDefinition, source }; 292CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, NullablePublicOnlyAttributeDefinition, source }; 311CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, source }; 331CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, source }; 378CSharpTestSource sources = new[] { NullableAttributeDefinition, NullableContextAttributeDefinition, NullablePublicOnlyAttributeDefinition, source };
Diagnostics\GetDiagnosticsTests.cs (1)
499var compilation = CreateCompilationWithMscorlib461(CSharpTestSource.None).WithEventQueue(new AsyncQueue<CompilationEvent>());
PartialEventsAndConstructorsTests.cs (2)
2457void verify(params CSharpTestSource sources) 2528void verify(params CSharpTestSource sources)
Semantics\ExperimentalAttributeTests.cs (3)
1552var comp = CreateCompilation(new CSharpTestSource[] { (src, "0.cs"), libSrc, experimentalAttributeSrc }); 1578var comp = CreateCompilation(new CSharpTestSource[] { (src, "0.cs"), experimentalAttributeSrc }); 2821var libsSrc = new CSharpTestSource[] { libSrc, experimentalAttributeSrc,
Semantics\ExtensionTests.cs (1)
12990static void verify(CSharpTestSource src, params DiagnosticDescription[] expected)
Semantics\LockTests.cs (1)
1628CSharpTestSource sources = [source, LockTypeDefinition];
Semantics\RecordTests.cs (2)
23private static CSharpCompilation CreateCompilation(CSharpTestSource source) 28CSharpTestSource src,
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
695ImmutableArray<InterceptableLocation> getInterceptableLocations(CSharpTestSource source)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (1)
IOperation\IOperationTests_IInterpolatedStringOperation.cs (1)
18private static CSharpTestSource GetSource(string code, bool hasDefaultHandler)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (81)
Semantics\AnonymousFunctionTests.cs (1)
22internal CompilationVerifier VerifyInPreview(CSharpTestSource source, string expectedOutput, Action<ModuleSymbol>? symbolValidator = null, params DiagnosticDescription[] expected)
Semantics\InterceptorsTests.cs (77)
30private static readonly SyntaxTree s_attributesTree = CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors); 32private static ImmutableArray<InterceptableLocation?> GetInterceptableLocations(CSharpTestSource source) 195var source = CSharpTestSource.Parse(""" 211var interceptors = CSharpTestSource.Parse($$""" 223var attributesTree = CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, options: options); 1387var source = CSharpTestSource.Parse(""" 1999var source = CSharpTestSource.Parse(""" 2016var interceptors = CSharpTestSource.Parse($$""" 2103var source = CSharpTestSource.Parse(""" 2132var interceptors = CSharpTestSource.Parse($$""" 2294var source = CSharpTestSource.Parse(""" 2319var interceptors = CSharpTestSource.Parse($$""" 3551var sourceTree = CSharpTestSource.Parse(""" 3582var interceptorTree = CSharpTestSource.Parse($$""" 3605var sourceTree = CSharpTestSource.Parse(""" 3632var interceptorTree = CSharpTestSource.Parse($$""" 6167var source = CSharpTestSource.Parse(""" 6184var interceptors = CSharpTestSource.Parse($$""" 6196comp = CreateCompilation([source, interceptors, s_attributesTree, CSharpTestSource.Parse(UnmanagedCallersOnlyAttributeDefinition, "UnmanagedCallersOnlyAttribute.cs", RegularWithInterceptors)]); 7313var source = CSharpTestSource.Parse(""" 7330var interceptors = CSharpTestSource.Parse($$""" 7340var verifier = CompileAndVerify([source, interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)], expectedOutput: "1"); 7344interceptors = CSharpTestSource.Parse($$""" 7355verifier = CompileAndVerify([source, interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)], expectedOutput: "1"); 7362var tree = CSharpTestSource.Parse(""" 7414var interceptors = CSharpTestSource.Parse($$""" 7425var comp = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7446var interceptors = CSharpTestSource.Parse($$""" 7457var comp = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7470var interceptors = CSharpTestSource.Parse($$""" 7481var comp = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7492var interceptors = CSharpTestSource.Parse($$""" 7503var comp = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7515var source = CSharpTestSource.Parse(""" 7532var interceptors = CSharpTestSource.Parse($$""" 7543var comp1 = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7566var sourceTree1 = CSharpTestSource.Parse(source, path: "Program1.cs", options: RegularWithInterceptors); 7573var interceptors = CSharpTestSource.Parse($$""" 7586CSharpTestSource.Parse(source, path: "Program2.cs", options: RegularWithInterceptors), 7588CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7600var source = CSharpTestSource.Parse(""" 7619var interceptors = CSharpTestSource.Parse($$""" 7629comp = CreateCompilation([source, interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7641var source = CSharpTestSource.Parse(""" 7675var interceptors = CSharpTestSource.Parse($$""" 7686var comp = CreateCompilation([interceptors, CSharpTestSource.Parse(s_attributesSource.text, s_attributesSource.path, RegularWithInterceptors)]); 7698var tree = CSharpTestSource.Parse(""" 7723var source = CSharpTestSource.Parse(""" 7741var interceptors = CSharpTestSource.Parse($$""" 7765var source = CSharpTestSource.Parse(""" 7787var interceptors = CSharpTestSource.Parse($$""" 7810var source = CSharpTestSource.Parse(""" 7828var interceptors = CSharpTestSource.Parse($$""" 7851var source = CSharpTestSource.Parse(""" 7869var interceptors = CSharpTestSource.Parse($$""" 7892var source = CSharpTestSource.Parse(""" 7913var interceptors = CSharpTestSource.Parse($$""" 7935var source = CSharpTestSource.Parse($$""" 7956var interceptors = CSharpTestSource.Parse($$""" 7985var source = CSharpTestSource.Parse($$""" 8009var interceptors = CSharpTestSource.Parse($$""" 8036var source = CSharpTestSource.Parse(""" 8055var interceptors = CSharpTestSource.Parse($$""" 8090var source = CSharpTestSource.Parse(""" 8114var interceptors = CSharpTestSource.Parse($$""" 8149var source = CSharpTestSource.Parse(""" 8174var interceptors = CSharpTestSource.Parse($$""" 8205var source = CSharpTestSource.Parse(""" 8229var interceptors = CSharpTestSource.Parse($$""" 8260var source = CSharpTestSource.Parse(""" 8284var interceptors = CSharpTestSource.Parse($$""" 8315var source = CSharpTestSource.Parse(""" 8334var interceptors = CSharpTestSource.Parse($$""" 8365var source = CSharpTestSource.Parse(""" 8392var interceptors = CSharpTestSource.Parse($$""" 8430var source = CSharpTestSource.Parse(""" 8456var interceptors = CSharpTestSource.Parse($$"""
Semantics\NullableReferenceTypesTests.cs (1)
97private CSharpCompilation CreateNullableCompilation(CSharpTestSource source,
Semantics\RecordStructTests.cs (2)
26private static CSharpCompilation CreateCompilation(CSharpTestSource source) 31CSharpTestSource src,
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (23)
Compilation\GetImportScopesTests.cs (1)
397private static CSharpCompilation CreateCompilationWithExternAlias(CSharpTestSource source, params string[] aliases)
DocumentationComments\DocumentationCommentCompilerTests.cs (9)
28CSharpTestSource source, 1285void verify(CSharpTestSource source) 1342void verify(CSharpTestSource source) 1405void verify(CSharpTestSource source) 1468void verify(CSharpTestSource source) 1966void verify(CSharpTestSource source) 2024void verify(CSharpTestSource source) 2088void verify(CSharpTestSource source) 2152void verify(CSharpTestSource source)
Symbols\CSharpCompilerFeatureRequiredTests.cs (4)
16public class CSharpCompilerFeatureRequiredTests : BaseCompilerFeatureRequiredTests<CSharpCompilation, CSharpTestSource> 22protected override CSharpTestSource GetUsage() => """ 58protected override CSharpCompilation CreateCompilationWithIL(CSharpTestSource source, string ilSource) 63protected override CSharpCompilation CreateCompilation(CSharpTestSource source, MetadataReference[] references)
Symbols\Metadata\PE\NoPiaLocalHideAndTypeSubstitutionTests.cs (4)
86var localConsumer = CreateEmptyCompilation(assemblyName: "Dummy3", source: CSharpTestSource.None, 316var localConsumer = CreateEmptyCompilation(assemblyName: "Dummy", source: CSharpTestSource.None, 338var localConsumer = CreateEmptyCompilation(assemblyName: "Dummy", source: CSharpTestSource.None, 360var localConsumer = CreateEmptyCompilation(assemblyName: "Dummy", source: CSharpTestSource.None,
Symbols\RequiredMembersTests.cs (1)
22private static CSharpCompilation CreateCompilationWithRequiredMembers(CSharpTestSource source, IEnumerable<MetadataReference>? references = null, CSharpParseOptions? parseOptions = null, CSharpCompilationOptions? options = null, string? assemblyName = null, TargetFramework targetFramework = TargetFramework.Standard)
Symbols\Source\FileModifierTests.cs (2)
832var testSource1 = CSharpTestSource.Parse(source, Path.Combine(root1, "code.cs")); 833var testSource2 = CSharpTestSource.Parse(source, Path.Combine(root2, "code.cs"));
Symbols\Source\RecordTests.cs (2)
16private static CSharpCompilation CreateCompilation(CSharpTestSource source) 19private CompilationVerifier CompileAndVerify(CSharpTestSource src, string? expectedOutput = null)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (57)
CSharpTestBase.cs (40)
1375CSharpTestSource source, 1411CSharpTestSource source, 1447CSharpTestSource source, 1489CSharpTestSource source, 1525CSharpTestSource source, 1561CSharpTestSource source, 1640internal CompilationVerifier CompileAndVerifyFieldMarshal(CSharpTestSource source, Dictionary<string, byte[]> expectedBlobs, bool isField = true) => 1650internal CompilationVerifier CompileAndVerifyFieldMarshal(CSharpTestSource source, Func<string, PEAssembly, byte[]> getExpectedBlob, bool isField = true) => 1659=> CSharpTestSource.Parse(text, filename, options, encoding, checksumAlgorithm); 1695CSharpTestSource source, 1704CSharpTestSource source, 1718CSharpTestSource source, 1726CSharpTestSource source, 1744CSharpTestSource source, 1752CSharpTestSource source, 1762CSharpTestSource source, 1770CSharpTestSource source, 1778CSharpTestSource source, 1794CSharpTestSource source, 1802CSharpTestSource source, 1815CSharpTestSource source, 1842CSharpTestSource source, 1855CSharpTestSource source, 1865CSharpTestSource source, 2014CSharpTestSource? source, 2019var trees = (source ?? CSharpTestSource.None).GetSyntaxTrees(parseOptions); 2672CSharpTestSource testSrc, 2723CSharpTestSource testSrc, 2758CSharpTestSource testSrc, 2778CSharpTestSource testSrc, 2816CSharpTestSource testSrc, 2836CSharpTestSource testSrc, 2874protected static CSharpCompilation CreateCompilationWithSpan(CSharpTestSource tree, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null) 2891protected static CSharpCompilation CreateCompilationWithMscorlibAndSpan(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null) 2923protected static CSharpCompilation CreateCompilationWithIndex(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null) 2934protected static CSharpCompilation CreateCompilationWithIndexAndRange(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null) 2945protected static CSharpCompilation CreateCompilationWithIndexAndRangeAndSpan(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null) 2956protected static CSharpCompilation CreateCompilationWithSpanAndMemoryExtensions(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null, TargetFramework targetFramework = TargetFramework.NetCoreApp) 2974protected static CSharpCompilation CreateCompilationWithIndexAndRangeAndSpanAndMemoryExtensions(CSharpTestSource text, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null, TargetFramework targetFramework = TargetFramework.NetCoreApp) 3253internal static CSharpCompilation CreateRuntimeAsyncCompilation(CSharpTestSource source, CSharpCompilationOptions? options = null, CSharpParseOptions? parseOptions = null, bool includeSuppression = true)
CSharpTestSource.cs (17)
23public readonly struct CSharpTestSource : IEnumerable<CSharpTestSource> 25public static CSharpTestSource None => new CSharpTestSource(null); 69case CSharpTestSource[] testSources: 78public static implicit operator CSharpTestSource(string source) => new CSharpTestSource(source); 79public static implicit operator CSharpTestSource(string[] source) => new CSharpTestSource(source); 80public static implicit operator CSharpTestSource((string Source, string FileName) source) => new CSharpTestSource(source); 81public static implicit operator CSharpTestSource((string Source, string FileName)[] source) => new CSharpTestSource(source); 82public static implicit operator CSharpTestSource(SyntaxTree source) => new CSharpTestSource(source); 83public static implicit operator CSharpTestSource(SyntaxTree[] source) => new CSharpTestSource(source); 84public static implicit operator CSharpTestSource(List<SyntaxTree> source) => new CSharpTestSource(source.ToArray()); 85public static implicit operator CSharpTestSource(ImmutableArray<SyntaxTree> source) => new CSharpTestSource(source.ToArray()); 86public static implicit operator CSharpTestSource(CSharpTestSource[] source) => new CSharpTestSource(source); 89IEnumerator<CSharpTestSource> IEnumerable<CSharpTestSource>.GetEnumerator() => throw new NotImplementedException(); 94public static CSharpTestSource Create(ReadOnlySpan<CSharpTestSource> source)
Microsoft.CodeAnalysis.Features.UnitTests (1)
EditAndContinue\EditAndContinueMethodDebugInfoReaderTests.cs (1)
65var tree = CSharpTestSource.Parse(source, path: "/a/c.cs", options: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), checksumAlgorithm: SourceHashAlgorithm.Sha1);
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
CSharpDeterministicKeyBuilderTests.cs (1)
77CSharpTestSource.Parse(@"System.Console.WriteLine(""Hello World"");", checksumAlgorithm: SourceHashAlgorithm.Sha1),
Microsoft.CodeAnalysis.UnitTests (9)
Analyzers\AnalyzerFileReferenceTests.cs (1)
485new[] { CSharpTestSource.Parse(generatorSource) },
Diagnostics\OperationTests.cs (1)
274var tree = CSharpTestSource.Parse(source);
Diagnostics\SuppressMessageAttributeCompilerTests.cs (2)
60syntaxTrees: new[] { CSharpTestSource.Parse(unconditionalSuppressMessageDef) }, 74CSharpTestSource.Parse(source, path: fileName) :
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1456CSharpTestSource.Parse(source, path: fileName) :
GivesAccessTo.cs (2)
22var csharpTree = CSharpTestSource.Parse(@" 29var csharpTree2 = CSharpTestSource.Parse(@"
IsSymbolAccessibleWithinTests.cs (1)
23var csharpTree = CSharpTestSource.Parse("class A { }");
MetadataReferences\MetadataReferenceTests.cs (1)
572syntaxTrees: new[] { CSharpTestSource.Parse("class C : System.Collections.ArrayList { }") },
VBCSCompiler.UnitTests (3)
AnalyzerConsistencyCheckerTests.cs (3)
55? new[] { CSharpTestSource.Parse(source) } 56: new[] { CSharpTestSource.Parse(source), CSharpTestSource.Parse(extraSource) };