7 instantiations of MockCSharpCompiler
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (6)
CommandLineTestBase.cs (1)
63return new MockCSharpCompiler(responseFile, buildPaths, args, analyzers.AsImmutableOrEmpty(), generators.AsImmutableOrEmpty(), loader, driverCache, additionalReferences.AsImmutableOrEmpty());
CommandLineTests.cs (5)
8468MockCSharpCompiler csc = new MockCSharpCompiler( 12388var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { "/features:UseLegacyStrongNameProvider", "/nostdlib", "a.cs" }); 12404var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { features, "a.cs" }); 12424var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { @"/features:InterceptorsNamespaces=NS1.NS2", @"/features:InterceptorsNamespaces=NS3.NS4", "a.cs" }); 12445var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { @"/features:InterceptorsPreviewNamespaces=NS1.NS2", "a.cs" });
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
CSharpDeterministicKeyBuilderTests.cs (1)
385var compiler = new MockCSharpCompiler(
157 references to MockCSharpCompiler
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (156)
CommandLineIVTTests.cs (7)
33var compiler = CreateCSharpCompiler(new[] { 110var compiler = CreateCSharpCompiler(new[] { 189var compiler = CreateCSharpCompiler(new[] { 274var compiler = CreateCSharpCompiler(new[] { 336var compiler = CreateCSharpCompiler(new[] { 350var compiler = CreateCSharpCompiler(new[] { 362var compiler = CreateCSharpCompiler(new[] {
CommandLineTestBase.cs (2)
55internal MockCSharpCompiler CreateCSharpCompiler(string[] args, DiagnosticAnalyzer[]? analyzers = null, ISourceGenerator[]? generators = null, AnalyzerAssemblyLoader? loader = null, GeneratorDriverCache? driverCache = null, MetadataReference[]? additionalReferences = null) 60internal MockCSharpCompiler CreateCSharpCompiler(string? responseFile, string workingDirectory, string[] args, DiagnosticAnalyzer[]? analyzers = null, ISourceGenerator[]? generators = null, AnalyzerAssemblyLoader? loader = null, GeneratorDriverCache? driverCache = null, MetadataReference[]? additionalReferences = null)
CommandLineTests.cs (111)
147var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path }); 167var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path }); 196var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 238var cmd = CreateCSharpCompiler( 289var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 341var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 377var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 401var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.Path }); 421var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.Path }); 455var cmd = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { "b.cs" }); 584var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/nosdkpath", "/r:System.dll", "a.cs" }); 1879var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/langversion:?" }); 2253var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:embedded", "/sourcelink:sl.json", "a.cs" }); 2285var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:portable", "/sourcelink:sl.json", "a.cs" }); 2314var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:full", "/sourcelink:sl.json", "a.cs" }); 2457var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", debugSwitch, embedSwitch, "embed.cs", "embed2.cs" }); 2788var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/a:missing.dll", "a.cs" }); 2811var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + typeof(object).Assembly.Location, "a.cs" }); 2928var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs" }); 2964var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path }); 2997var csc = CreateCSharpCompiler(null, dir.Path, 3516var csc = CreateCSharpCompiler(null, dir.Path, 3585var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "a.cs" }); 4494var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.Path }); 6359var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", binaryPath }); 6452var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 6551var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 6593var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 6634var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 6969var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/target:exe", "a.cs" }); 6991var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/target:exe", "a.cs" }); 7015var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/target:library", "a.cs" }); 7038var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", "a.cs" }); 7083var csc = CreateCSharpCompiler(null, dir.Path, commandLineArguments.Concat(new[] { inputName1, inputName2 }).ToArray()); 7127var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/r:missing.dll", "a.cs" }); 7203var csc = CreateCSharpCompiler(null, dir.Path, commandLineArguments.Concat(new[] { fileName }).ToArray()); 7226var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\a.exe" }); 7252var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\" }); 7280var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\ " }); 7308var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:aaa:\\a.exe" }); 7334var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out: " }); 7368var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keyfile:key.snk", }); 7390var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keycontainer:bbb", }); 7413var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keyFile:key.snk", "/features:UseLegacyStrongNameProvider" }); 7433var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "a.cs", "/features:disable-length-based-switch" }); 7806MockCSharpCompiler csc; 7873var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 7920var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 7954var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 7988var csc = CreateCSharpCompiler(rsp, WorkingDirectory, new[] { source, "/preferreduilang:en" }); 8409var csc = CreateCSharpCompiler(null, baseDir, new[] { source, "/preferreduilang:en" }); 8468MockCSharpCompiler csc = new MockCSharpCompiler( 8519MockCSharpCompiler csc = CreateCSharpCompiler(GetDefaultResponseFilePath(), WorkingDirectory, new[] { "/noconfig" }); 8997var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", $"/out:{exePath}", srcPath }); 9020var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", "/debug", $"/out:{exePath}", srcPath }); 9042var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", $"/doc:{xmlPath}", srcPath }); 9066var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", "/debug:" + format, $"/sourcelink:{sourceLinkPath}", srcPath }); 9094var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", $"/out:{exePath}", sourcePath }); 9120var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/debug-", $"/out:{exePath}", sourcePath }); 9145var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", "/doc:" + xmlPath, sourcePath }); 9248var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/target:library", "/out:Test.dll", "/doc:" + xmlPath, sourcePath }); 9419var comp = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/errorendlocation" }); 9446var csc = CreateCSharpCompiler( 9478var csc = CreateCSharpCompiler( 9505var csc = CreateCSharpCompiler( 9565var csc = CreateCSharpCompiler( 9601var csc = CreateCSharpCompiler( 9633var csc = CreateCSharpCompiler( 9658var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9683var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.Path }, 9705var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9727var comp = CreateCSharpCompiler(null, WorkingDirectory, new string[] { }); 9810var cmd = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/target:library", filePath }); 9903var cmd = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/r:com2.dll", "/target:library", "/preferreduilang:en", filePath }); 10104var compiler = CreateCSharpCompiler(null, WorkingDirectory, args); 10146var compiler = CreateCSharpCompiler(null, WorkingDirectory, args); 10654var csc = CreateCSharpCompiler(null, sourceDir.Path, args, analyzers: analyzers, generators: generators, driverCache: driverCache); 11274var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/keyfile:", "/target:library", "/nologo", "/preferreduilang:en", "a.cs" }); 11286var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/keyfile:\"\"", "/target:library", "/nologo", "/preferreduilang:en", "a.cs" }); 11298var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/keyfile:", "/publicsign", "/target:library", "/nologo", "/preferreduilang:en", "a.cs" }); 11310var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/keyfile:\"\"", "/publicsign", "/target:library", "/nologo", "/preferreduilang:en", "a.cs" }); 11692var csc = CreateCSharpCompiler(null, dir.Path, args); 11871var csc = CreateCSharpCompiler(null, dir.Path, 11936var csc = CreateCSharpCompiler(null, dir.Path, 11987var csc = CreateCSharpCompiler(null, dir.Path, 12365var csc = CreateCSharpCompiler(null, dir.Path, args); 12388var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { "/features:UseLegacyStrongNameProvider", "/nostdlib", "a.cs" }); 12404var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { features, "a.cs" }); 12424var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { @"/features:InterceptorsNamespaces=NS1.NS2", @"/features:InterceptorsNamespaces=NS3.NS4", "a.cs" }); 12445var csc = new MockCSharpCompiler(null, buildPaths, args: new[] { @"/features:InterceptorsPreviewNamespaces=NS1.NS2", "a.cs" }); 12570var compiler = CreateCSharpCompiler(null, WorkingDirectory, new[] 12590var compiler = CreateCSharpCompiler(null, WorkingDirectory, new[] 13495var cmd = CreateCSharpCompiler(null, dir.Path, arguments, 13740var cmd = CreateCSharpCompiler(null, dir.Path, arguments, 13831var cmd = CreateCSharpCompiler(null, dir.Path, args, analyzers: new[] { analyzer }); 13868var cmd = CreateCSharpCompiler(null, dir.Path, args, analyzers: new[] { analyzer }); 14837var cmd = CreateCSharpCompiler(null, dir.Path, args, generators: new[] { generator }); 14897var cmd = CreateCSharpCompiler(null, dir.Path, 14917var cmd = CreateCSharpCompiler(null, dir.Path, 14942var cmd = CreateCSharpCompiler(null, dir.Path, 14962var cmd = CreateCSharpCompiler(null, dir.Path, 15040var csc = CreateCSharpCompiler( 15068var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15149var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15674var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15726var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15808var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15861var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15939var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15978var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 16018var cmd = CreateCSharpCompiler(null, dir.Path, new[] {
SarifErrorLoggerTests.cs (15)
23internal abstract string GetExpectedOutputForNoDiagnostics(MockCSharpCompiler cmd); 24internal abstract string GetExpectedOutputForSimpleCompilerDiagnostics(MockCSharpCompiler cmd, string sourceFile); 25internal abstract string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed(MockCSharpCompiler cmd, string sourceFile, params string[] suppressionKinds); 26internal abstract string GetExpectedOutputForAnalyzerDiagnosticsWithAndWithoutLocation(MockCSharpCompiler cmd); 27internal abstract string GetExpectedOutputForAnalyzerDiagnosticsWithSuppression(MockCSharpCompiler cmd, string justification, string suppressionType, params string[] suppressionKinds); 28internal abstract string GetExpectedOutputForAnalyzerDiagnosticsWithWarnAsError(MockCSharpCompiler cmd); 47var cmd = CreateCSharpCompiler(arguments); 78var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments); 112var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments); 145var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 181var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 216var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 251var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 286var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 319var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments,
SarifV1ErrorLoggerTests.cs (6)
21internal override string GetExpectedOutputForNoDiagnostics(MockCSharpCompiler cmd) 39internal override string GetExpectedOutputForSimpleCompilerDiagnostics(MockCSharpCompiler cmd, string sourceFile) 114internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed(MockCSharpCompiler cmd, string sourceFile, params string[] suppressionKinds) 192internal override string GetExpectedOutputForAnalyzerDiagnosticsWithAndWithoutLocation(MockCSharpCompiler cmd) 199internal override string GetExpectedOutputForAnalyzerDiagnosticsWithSuppression(MockCSharpCompiler cmd, string justification, string suppressionType, params string[] suppressionKinds) 206internal override string GetExpectedOutputForAnalyzerDiagnosticsWithWarnAsError(MockCSharpCompiler cmd)
SarifV2ErrorLoggerTests.cs (11)
28internal override string GetExpectedOutputForNoDiagnostics(MockCSharpCompiler cmd) 60internal override string GetExpectedOutputForSimpleCompilerDiagnostics(MockCSharpCompiler cmd, string sourceFile) 163internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed(MockCSharpCompiler cmd, string sourceFile, params string[] suppressionKinds) 273internal override string GetExpectedOutputForAnalyzerDiagnosticsWithAndWithoutLocation(MockCSharpCompiler cmd) 307internal override string GetExpectedOutputForAnalyzerDiagnosticsWithSuppression(MockCSharpCompiler cmd, string justification, string suppressionType, params string[] suppressionKinds) 341internal override string GetExpectedOutputForAnalyzerDiagnosticsWithWarnAsError(MockCSharpCompiler cmd) 418MockCSharpCompiler compiler, 451var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 533var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 603var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments, 683var cmd = CreateCSharpCompiler(null, WorkingDirectory, arguments);
TouchedFileLoggingTests.cs (4)
42var cmd = CreateCSharpCompiler(new[] { "/nologo", hello, 83var cmd = CreateCSharpCompiler( 118var cmd = CreateCSharpCompiler( 156var cmd = CreateCSharpCompiler(new[]
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
CSharpDeterministicKeyBuilderTests.cs (1)
385var compiler = new MockCSharpCompiler(