1 type derived from TempFile
Microsoft.CodeAnalysis.Test.Utilities (1)
TempFiles\DisposableFile.cs (1)
15public sealed class DisposableFile : TempFile, IDisposable
422 references to TempFile
InteractiveHost.UnitTests (23)
AbstractInteractiveHostTests.cs (1)
196var file = dir.CreateFile(fileName);
InteractiveHostCoreInitTests.cs (1)
55var dll = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSInterfaces01);
InteractiveHostDesktopInitTests.cs (1)
28var dll = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSInterfaces01);
InteractiveHostDesktopTests.cs (20)
270var file = Temp.CreateFile().WriteAllText("#load blah.csx" + "\r\n" + "class C {}"); 458var file1 = dir1.CreateFile("c.dll").WriteAllBytes(TestResources.General.C1); 461var file2 = dir2.CreateFile("c.dll").WriteAllBytes(TestResources.General.C2); 504var file = dir.CreateFile("c.dll").WriteAllBytes(c1.EmitToArray()); 544var file1 = dir1.CreateFile("c.dll").WriteAllBytes(c1.EmitToArray()); 548var file2 = dir2.CreateFile("c.dll").WriteAllBytes(c2.EmitToArray()); 579var file1 = dir1.CreateFile("c.dll").WriteAllBytes(c1.EmitToArray()); 583var file2 = dir2.CreateFile("c.dll").WriteAllBytes(c2.EmitToArray()); 691var initFile = initDirectory.CreateFile("init.csx"); 703var rspFile = rspDirectory.CreateFile("init.rsp"); 735var initFile = initDirectory.CreateFile("init.csx"); 741var rspFile = rspDirectory.CreateFile("init.rsp"); 754var rspFile = Temp.CreateFile(); 810var initFile = Temp.CreateFile(extension: ".csx").WriteAllText("1 1"); 812var rspFile = Temp.CreateFile(); 838var scriptFile = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 840var rspFile = Temp.CreateFile(); 910var dll = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll); 942var libFile = Temp.CreateFile("lib").WriteAllBytes(lib.EmitToArray()); 1022var rspFile = Temp.CreateFile();
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (38)
CopyRefAssemblyTests.cs (6)
46var file = dir.CreateFile("example.dll"); 64var file = dir.CreateFile("example.dll"); 84var source = dir.CreateFile("example.dll"); 86var dest = dir.CreateFile("dest.dll"); 111var source = dir.CreateFile("mvid1.dll"); 115var dest = dir.CreateFile("mvid2.dll");
DotNetSdkTests.cs (24)
26var libFile = sourcePackageDir.CreateFile("lib.cs").WriteAllText("class Lib { public void M() { } }"); 410var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 412var srcFile2 = subdir.CreateFile("lib2.cs").WriteAllText("class D { }"); 413var editorConfigFile2 = subdir.CreateFile(".editorconfig").WriteAllText(@"[*.cs] 440var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 442var srcFile2 = subdir.CreateFile("lib2.cs").WriteAllText("class D { }"); 443var editorConfigFile2 = subdir.CreateFile(".editorconfig").WriteAllText(@"[*.cs] 468var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 469var globalConfigFile = ProjectDir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 472var srcFile2 = subdir.CreateFile("lib2.cs").WriteAllText("class D { }"); 473var globalConfigFile2 = subdir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 502var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 503var globalConfigFile = ProjectDir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 506var srcFile2 = subdir.CreateFile("lib2.cs").WriteAllText("class D { }"); 507var globalConfigFile2 = subdir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 535var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 536var globalConfigFile = ProjectDir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 539var srcFile2 = subdir.CreateFile("lib2.cs").WriteAllText("class D { }"); 540var globalConfigFile2 = subdir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 599var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 600var globalConfigFile = ProjectDir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 603var globalConfigFile2 = subdir.CreateFile(".globalconfig").WriteAllText(@"is_global = true 629var srcFile = ProjectDir.CreateFile("lib1.cs").WriteAllText("class C { }"); 630var globalConfigFile = ProjectDir.CreateFile("mycustom.config").WriteAllText(@"is_global = true
IntegrationTests.cs (7)
80TempFile file = currentDirectory.CreateFile(pair.Key); 96private ProcessResult RunCompilerOutput(TempFile file) 619var slnFile = testDir.CreateFile("Console;!@(goo)'^(Application1.sln").WriteAllText( 648var appProjFile = appDir.CreateFile(@"Cons.ole;!@(goo)'^(Application1.csproj").WriteAllText( 698var appProgramFile = appDir.CreateFile("Program.cs").WriteAllText( 716var libraryProjFile = libraryDir.CreateFile("Class;!@(goo)'^(Library1.csproj").WriteAllText( 772var libraryClassFile = libraryDir.CreateFile("Class1.cs").WriteAllText(
TestUtilities\DotNetSdkTestBase.cs (1)
55protected readonly TempFile Project;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (53)
CommandLineIVTTests.cs (4)
26var source2 = dir.CreateFile("B.cs").WriteAllText(""" 103var source2 = dir.CreateFile("B.cs").WriteAllText(""" 181var source2 = dir.CreateFile("B.cs").WriteAllText(""" 264var source2 = dir.CreateFile("B.cs").WriteAllText("""
CommandLineTests.cs (47)
138var src = dir.CreateFile("temp.cs").WriteAllText(@" 163var src = dir.CreateFile("temp.cs").WriteAllText("class C {}"); 187var src = dir.CreateFile("test.cs").WriteAllText(@" 192var analyzerConfig = dir.CreateFile(".editorconfig").WriteAllText(@" 217var src = dir.CreateFile("Class1.cs").WriteAllText(""" 229var editorconfig = dir.CreateFile(".editorconfig").WriteAllText(""" 273var src = dir.CreateFile("test.cs").WriteAllText(@" 278var additionalFile = dir.CreateFile("file.txt"); 279var analyzerConfig = dir.CreateFile(".editorconfig").WriteAllText(@" 332var src = dir.CreateFile("test.cs").WriteAllText(@" 337var analyzerConfig = dir.CreateFile(".editorconfig").WriteAllText(@" 364var src = dir.CreateFile("test.cs").WriteAllText(@" 373var analyzerConfig1 = dir.CreateFile("analyzerconfig1").WriteAllText(configText); 374var analyzerConfig2 = dir.CreateFile("analyzerconfig2").WriteAllText(configText); 398var src = dir.CreateFile("sjis.cs").WriteAllBytes(TestResources.General.ShiftJisSource); 418var src = dir.CreateFile("sjis.cs").WriteAllBytes(TestResources.General.ShiftJisSource); 579var file = dir.CreateFile("a.cs"); 741var f = folder.CreateFile(file); 1224var file1 = dir.CreateFile("a.cs"); 1225var file2 = dir.CreateFile("b.cs"); 1226var file3 = dir.CreateFile("c.txt"); 1227var file4 = dir.CreateDirectory("d1").CreateFile("d.txt"); 1228var file5 = dir.CreateDirectory("d2").CreateFile("e.cs"); 2243var src = dir.CreateFile("a.cs"); 2246var sl = dir.CreateFile("sl.json"); 2275var src = dir.CreateFile("a.cs"); 2278var sl = dir.CreateFile("sl.json"); 2303var src = dir.CreateFile("a.cs"); 2306var sl = dir.CreateFile("sl.json"); 2429var src = dir.CreateFile("embed.cs"); 2430var src2 = dir.CreateFile("embed2.cs"); 2431var txt = dir.CreateFile("embed.xyz"); 2816private TempFile CreateRuleSetFile(string source) 2837var file = CreateRuleSetFile(source); 2863var file = CreateRuleSetFile(source); 2892var file = CreateRuleSetFile("Random text"); 2957var ruleSetFile = CreateRuleSetFile(rulesetSource); 2990var ruleSetFile = CreateRuleSetFile(rulesetSource); 3509var ruleSetFile = CreateRuleSetFile(rulesetSource); 9287TempFile tempFile = tempDir.CreateFile("a.cs").WriteAllText(@"public class A { }"); 10551private string VerifyOutput(TempDirectory sourceDir, TempFile sourceFile, 11620var src = dir.CreateFile("a.cs").WriteAllText(source); 13422var rulesetFile = CreateRuleSetFile(rulesetText); 13570var rulesetFile = CreateRuleSetFile(source); 13874TempFile analyzerConfig; 15078var none = Array.Empty<TempFile>(); 15095void verify(TempFile[] configs, int expectedWarnings = 0, int expectedErrors = 0, string noWarn = "0")
SarifV2ErrorLoggerTests.cs (1)
678var sourceFile = errorLogDir.CreateFile("myfile.cs").WriteAllText(source);
TouchedFileLoggingTests.cs (1)
152var xml = Temp.CreateFile();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
Emit\CompilationEmitTests.cs (1)
1996var snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey);
Emit\ResourceTests.cs (3)
43var exe = Temp.CreateFile(); 133var exe = Temp.CreateFile(); 833var exeFile = Temp.CreateFile();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (20)
Attributes\AttributeTests_Security.cs (2)
1478var tempFile = tempDir.CreateFile("pset.xml"); 1569var tempFile = tempDir.CreateFile("pset.xml");
Attributes\InternalsVisibleToAndStrongNameTests.cs (18)
380var tempFile = Temp.CreateFile().WriteAllBytes(new byte[] { 1, 2, 3, 4 }); 533var snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey); 606var snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey); 628var pubKeyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snPublicKey); 650var pubKeyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snPublicKey); 715var snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey); 736var snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey); 1504var tempFile = Temp.CreateFile(); 1515private static bool IsFileFullSigned(TempFile file) 1530var tempFile = Temp.CreateFile(); 2515var tempFile = Temp.CreateFile(); 2542var tempFile = Temp.CreateFile(); 2573var tempFile = Temp.CreateFile(); 2603var tempFile = Temp.CreateFile(); 2633var tempFile = Temp.CreateFile(); 2658var tempFile = Temp.CreateFile(); 2688var tempFile = Temp.CreateFile(); 2872var tempFile = Temp.CreateFile();
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (43)
InteractiveSessionReferencesTests.cs (43)
343var c1 = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.General.C1); 344var c2 = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.General.C2); 359var c1 = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.General.C1); 360var c2 = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.General.C2); 376var c1 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 379var c2 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 395var c1 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 398var c2 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 415var c1 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 418var c2 = Temp.CreateFile(extension: ".dll").WriteAllBytes( 625var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 626var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBaseImage); 629var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 630var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBaseImage); 683var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 684var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBaseImage); 687var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 688var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBaseImage); 749var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 750var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 753var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 754var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 817var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 818var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 821var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 822var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 885var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 886var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 889var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 890var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 953var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 954var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 957var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 958var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 1021var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 1022var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 1025var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 1026var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 1089var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 1090var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 1093var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 1094var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image); 1120var libFile = Temp.CreateFile("lib").WriteAllBytes(lib.EmitToArray());
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (34)
CommandLineRunnerTests.cs (22)
264var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 266var rsp = Temp.CreateFile(extension: ".rsp").WriteAllText($@" 297var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 314var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 331var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 333var rsp = Temp.CreateFile(extension: ".rsp").WriteAllText($@" 363var script = Temp.CreateFile(prefix: "@", extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);"); 381var script = dir.CreateFile("--").WriteAllText("foreach (var arg in Args) Print(arg);"); 446var script = Temp.CreateFile(extension: ".csx").WriteAllText("WriteLine(42);"); 487var script = directory.CreateFile(scriptName).WriteAllText("Print(3);"); 527var main = Temp.CreateFile(extension: ".csx").WriteAllText(@" 558var main = Temp.CreateFile(extension: ".csx").WriteAllText(@" 596var main = dir.CreateFile("a.csx").WriteAllText("int X = 1;"); 632var main = dir.CreateFile("C.dll").WriteAllBytes(TestResources.General.C1); 667var rsp = Temp.CreateFile().WriteAllText(@" 706var init = Temp.CreateFile(extension: ".csx").WriteAllText(@" 724var reference = Temp.CreateFile(extension: ".dll").WriteAllBytes(TestResources.General.C1); 726var init = Temp.CreateFile(extension: ".csx").WriteAllText(@" 828var file1 = dir1.CreateFile(lib1Name + ".dll").WriteAllBytes(lib1Image); 829var fileBase1 = dir1.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase1Image); 832var file2 = dir2.CreateFile(lib2Name + ".dll").WriteAllBytes(lib2Image); 833var fileBase2 = dir2.CreateFile(libBaseName + ".dll").WriteAllBytes(libBase2Image);
InteractiveSessionReferencesTests.cs (6)
39var libFile = dir.CreateFile("lib.dll").WriteAllBytes(libImage); 87var libDFile = dir2.CreateFile("libD.dll").WriteAllBytes(libDImage); 91var libAFile = dir1.CreateFile("libA.dll").WriteAllBytes(libAImage); 94var libBFile = dir2.CreateFile("libB.dll").WriteAllBytes(libBImage); 132var libBFile = dir.CreateFile("libB1.dll").WriteAllBytes(libBImage); 136var libAFile = dir.CreateFile("libA.dll").WriteAllBytes(libAImage);
InteractiveSessionTests.cs (6)
1204var file1 = Temp.CreateFile(); 1205var file2 = Temp.CreateFile(); 1234var file = Temp.CreateFile(); 1252var file = Temp.CreateFile(); 1290var fileMain = dir.CreateFile(mainName + ".dll").WriteAllBytes(mainImage); 1320var fileMain = dir.CreateFile(mainName + ".dll").WriteAllBytes(mainImage);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\SemanticErrorTests.cs (1)
21969var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("&");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (59)
Compilation\ReferenceManagerTests.cs (2)
1038var exe1 = dir1.CreateFile("CS1704.dll").WriteAllBytes(peImage); 1041var exe2 = dir2.CreateFile("CS1704.dll").WriteAllBytes(peImage);
DocumentationComments\DocumentationCommentCompilerTests.cs (51)
3441var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3476var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3514var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3549var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3585var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3646var dir1XmlFile = dir1.CreateFile("test.xml").WriteAllText(xml1); 3649var dir2XmlFile = dir2.CreateFile("test.xml").WriteAllText(xml2); 3652var dir3XmlFile = dir3.CreateFile("test.xml").WriteAllText(xml3); 3733var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3804var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 3836var xmlFile = Temp.CreateFile(extension: ".xml"); 3873var xmlFile1 = Temp.CreateFile(extension: ".xml"); 3876var xmlFile2 = Temp.CreateFile(extension: ".xml").WriteAllText(string.Format("<include file='{0}' path='path'/>", xmlFilePath1)); 3909var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<element/>"); 3943var xmlFile1 = Temp.CreateFile(extension: ".xml").WriteAllText("<element/>"); 3946var xmlFile2 = Temp.CreateFile(extension: ".xml").WriteAllText(string.Format("<include file='{0}' path=':'/>", xmlFilePath1)); 3976var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<OpenWithoutClose>"); 4010var xmlFile1 = Temp.CreateFile(extension: ".xml").WriteAllText("<OpenWithoutClose>"); 4013var xmlFile2 = Temp.CreateFile(extension: ".xml").WriteAllText(string.Format("<include file='{0}' path='path'/>", xmlFilePath1)); 4043var xmlFile = Temp.CreateFile(extension: ".xml"); 4075var xmlFile = Temp.CreateFile(extension: ".xml"); 4109var xmlFile = Temp.CreateFile(extension: ".xml"); 4163var xmlFile = Temp.CreateFile(extension: ".xml"); 4202var xmlFile1 = Temp.CreateFile(extension: ".xml"); 4205var xmlFile2 = Temp.CreateFile(extension: ".xml"); 4241var xmlFile = Temp.CreateFile(extension: ".xml"); 4318var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<see cref=""Main""/>"); 4353var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<see cref=""M:Verbatim""/>"); 4388var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<see cref=""Int32""/>"); 4435var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<see cref=""#""/>"); 4476var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<see cref=""Invalid""/>"); 4530var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(seeElement); 4575var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(seeElement); 4652var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 4732var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 4803var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 4847var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<typeparam name=""#""/>"); 4885var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<param name=""Q""/>"); 4926var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<param name=""x""/>"); 4962var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(@"<param name=""x"" name=""y""/>"); 5004var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 5074var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 5243var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<stuff />"); 5957var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("&"); 7212var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml); 7301var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<hello/>"); 7324var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<hello/>"); 7343var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText("<hello/>"); 7381var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText( 7444var xmlFile = Temp.CreateFile(extension: ".xml"); 7601var xmlFile = dir.CreateFile("---.xml").WriteAllText(@"<summary attrib="""" attrib=""""/>");
DocumentationComments\DocumentationModeTests.cs (1)
368var xmlFile = Temp.CreateFile(extension: ".xml").WriteAllText(xml);
Symbols\Metadata\PE\TypeForwarders.cs (5)
1561var asmB = folderA.CreateFile("test.exe").WriteAllBytes(bitsB); 1566var asm1 = folderB.CreateFile("asm1.dll").WriteAllBytes(bits1); 1567var asm2 = folderB.CreateFile("asm2.dll").WriteAllBytes(bits2); 1568var asmB2 = folderB.CreateFile("test.exe").WriteAllBytes(bitsB); 1773var asm2 = folder.CreateFile("asm2.dll");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (1)
238var sourceFile = dir.CreateFile("test.cs").WriteAllText(source1, Encoding.UTF8);
Emit\CompilationOutputFilesTests.cs (2)
37var dllFile = dir.CreateFile("a.dll").WriteAllBytes(peImage); 38var pdbFile = dir.CreateFile("a.pdb").WriteAllBytes(pdbStream.ToArray());
Microsoft.CodeAnalysis.Features.UnitTests (19)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (18)
62var sourceFileA = dir.CreateFile("A.cs").WriteAllBytes(sourceBytesA1); 63var sourceFileB = dir.CreateFile("B.cs").WriteAllBytes(sourceBytesB1); 64var sourceFileC = dir.CreateFile("C.cs").WriteAllBytes(sourceBytesC1); 65var sourceFileD = dir.CreateFile("dummy").WriteAllBytes(sourceBytesD1); 66var sourceFileE = dir.CreateFile("E.cs").WriteAllBytes(sourceBytesE1); 196var moduleFile = Temp.CreateFile().WriteAllBytes(TestResources.Basic.Members); 306var moduleFile = Temp.CreateFile().WriteAllBytes(TestResources.Basic.Members); 480var moduleFile = Temp.CreateFile(); 564var sourceFile = dir.CreateFile("a.cs").WriteAllText(source1, Encoding.UTF8); 615var sourceFile = dir.CreateFile("a.cs").WriteAllText(source1, Encoding.UTF8); 672var sourceFileA = Temp.CreateFile().WriteAllText(sourceA, Encoding.UTF8); 673var sourceFileB = Temp.CreateFile().WriteAllText(sourceB, Encoding.UTF8); 758var sourceFile = dir.CreateFile("a.cs"); 911var sourceFile = dir.CreateFile("test.cs").WriteAllText(source1, encoding); 1136var sourceFile = dir.CreateFile("a.cs"); 1237var sourceFile = dir.CreateFile("a.cs").WriteAllText(source1, Encoding.UTF8); 1280var sourceFile = dir.CreateFile("a.cs").WriteAllText(source1, Encoding.UTF8); 1341var sourceFile = dir.CreateFile("a.cs").WriteAllText(source1, Encoding.UTF8);
EditAndContinue\UnitTestingHotReloadServiceTests.cs (1)
32var sourceFileA = dir.CreateFile("A.cs").WriteAllText(source1, Encoding.UTF8);
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (10)
MetadataShadowCopyProviderTests.cs (10)
85var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); 86var doc = dir.CreateFile("a.xml").WriteAllText("<hello>"); 103var dll = Temp.CreateFile().WriteAllText("blah"); 124var dll = Temp.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); 197var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); 198var doc = dir.CreateFile("a.xml").WriteAllText("<hello>"); 210var dll2 = dir2.CreateFile("a2.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); 224var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); 225var docInvariant = dir.CreateFile("a.xml").WriteAllText("Invariant"); 226var docGreek = dir.CreateDirectory(elGR.Name).CreateFile("a.xml").WriteAllText("Greek");
Microsoft.CodeAnalysis.Scripting.UnitTests (2)
RuntimeMetadataReferenceResolverTests.cs (2)
26var assembly1 = directory.CreateFile("_1.dll"); 27var assembly2 = directory.CreateFile("_2.dll");
Microsoft.CodeAnalysis.Test.Utilities (16)
AssemblyLoadTestFixture.cs (2)
389var delta1InAnalyzerReferencesDelta1 = analyzerReferencesDelta1Directory.CopyFile(Delta1); 541var tempFile = directory.CreateFile($"{assemblyName}.dll");
Platform\Desktop\TestHelpers.cs (3)
59public static TempFile CreateCSharpAnalyzerAssemblyWithTestAnalyzer(TempDirectory dir, string assemblyName) 75var immutable = dir.CopyFile(typeof(ImmutableArray).Assembly.Location); 76var analyzer = dir.CopyFile(typeof(DiagnosticAnalyzer).Assembly.Location);
TempFiles\TempDirectory.cs (3)
58public TempFile CreateFile(string name) 68public TempFile CreateOrOpenFile(string name) 78public TempFile CopyFile(string originalPath, string name = null)
TempFiles\TempFile.cs (7)
70public TempFile WriteAllText(string content, Encoding encoding) 76public TempFile WriteAllText(string content) 82public async Task<TempFile> WriteAllTextAsync(string content, Encoding encoding) 92public Task<TempFile> WriteAllTextAsync(string content) 97public TempFile WriteAllBytes(byte[] content) 103public TempFile WriteAllBytes(ImmutableArray<byte> content) 119public TempFile CopyContentFrom(string path)
TempFiles\TempRoot.cs (1)
61public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath] string callerSourcePath = null, [CallerLineNumber] int callerLineNumber = 0)
Microsoft.CodeAnalysis.UnitTests (44)
AnalyzerAssemblyLoaderTests.cs (1)
1606var tempFile = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1);
Analyzers\AnalyzerFileReferenceAppDomainTests.cs (4)
48var analyzerFile = DesktopTestHelpers.CreateCSharpAnalyzerAssemblyWithTestAnalyzer(dir, "MyAnalyzer"); 87var immutable = dir.CopyFile(typeof(ImmutableArray).Assembly.Location); 88var analyzer = dir.CopyFile(typeof(DiagnosticAnalyzer).Assembly.Location); 105var analyzerFile = dir.CreateFile("MyAnalyzer.dll").WriteAllBytes(analyzerCompilation.EmitToArray());
Analyzers\AnalyzerFileReferenceTests.cs (4)
310TempFile corlib = directory.CreateFile("mscorlib.dll"); 313TempFile source = directory.CreateFile("in.cs"); 339TempFile corlib = directory.CreateFile("mscorlib.dll"); 342TempFile source = directory.CreateFile("in.cs");
CommonCommandLineParserTests.cs (11)
34var file = dir.CreateFile("a.ruleset"); 39var newFile = dir.CreateFile("file" + i + ".ruleset"); 471var file = dir.CreateFile("a.ruleset"); 980var file = dir.CreateFile("a.ruleset"); 982var newFile = dir.CreateFile("file1.ruleset"); 1011var file = dir.CreateFile("a.ruleset"); 1045var file = dir.CreateFile("a.ruleset"); 1048var include = dir.CreateFile("file1.ruleset"); 1094var file = dir.CreateFile("a.ruleset"); 1097var include1 = dir.CreateFile("file1.ruleset"); 1100var include2 = dir.CreateFile("file2.ruleset");
MetadataReferences\AssemblyIdentityComparerTests.cs (1)
616var appConfig = Temp.CreateFile().WriteAllText(
MetadataReferences\AssemblyMetadataTests.cs (1)
141var invalidModuleName = Temp.CreateFile().WriteAllBytes(TestResources.MetadataTests.Invalid.InvalidModuleName);
MetadataReferences\AssemblyPortabilityPolicyTests.cs (17)
74var appConfig = Temp.CreateFile(); 112var appConfig = Temp.CreateFile(); 134var appConfig1 = Temp.CreateFile(); 135var appConfig2 = Temp.CreateFile(); 167var appConfig = Temp.CreateFile(); 215var appConfig = Temp.CreateFile(); 233var appConfig = Temp.CreateFile(); 251var appConfig = Temp.CreateFile(); 269var appConfig = Temp.CreateFile(); 287var appConfig = Temp.CreateFile(); 306var appConfig = Temp.CreateFile(); 326var appConfig = Temp.CreateFile(); 350var appConfig = Temp.CreateFile(); 370var appConfig = Temp.CreateFile(); 387var appConfig = Temp.CreateFile().WriteAllText(correctAppConfigText); 400var appConfig = Temp.CreateFile().WriteAllText(correctAppConfigText); 430var appConfig2 = Temp.CreateFile().WriteAllText(correctAppConfigText);
MetadataReferences\MetadataReferenceTests.cs (3)
95var file = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib); 161var file = Temp.CreateFile().WriteAllBytes(peImage); 185var file = Temp.CreateFile().WriteAllBytes(peImage);
Text\StringTextDecodingTests.cs (2)
304var tmpFile = Temp.CreateFile(); 320var tmpFile = Temp.CreateFile();
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (5)
CommandLineTests.vb (5)
2818Private Function CreateRuleSetFile(source As XDocument) As TempFile 6289Private Shared Function ReplacePathAndVersionAndHash(result As XElement, file As TempFile) As String 6833Dim manifestFile As TempFile 7926Private Shared Function VerifyOutput(sourceDir As TempDirectory, sourceFile As TempFile, 10293Dim analyzerConfig As TempFile
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Attributes\InternalsVisibleToAndStrongNameTests.vb (1)
1453Private Shared Sub AssertFileIsSigned(file As TempFile)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
DocumentationComments\DocCommentTests.vb (1)
11925Private Shared Function AsXmlCommentText(file As TempFile) As String
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
WorkspaceTestBase.cs (1)
54var file = dir.CreateFile(fileName);
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (1)
23var tempFile = tempDirectory.CreateFile("CSharpClass.cs");
SolutionTests\SolutionTests.cs (5)
1604var fileD = Temp.CreateFile(); 3291var file = Temp.CreateFile().WriteAllText(text1, Encoding.UTF8); 3345var file = Temp.CreateFile().WriteAllText(text, Encoding.UTF8); 3412var file = Temp.CreateFile().WriteAllText(text, Encoding.UTF8); 4505var file = root.CreateFile(prefix: "massiveFile", extension: ".cs").WriteAllText("hello");
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (18)
PersistentStorage\AbstractPersistentStorageTests.cs (3)
978var solutionFile = persistentFolder.CreateOrOpenFile("Solution1.sln").WriteAllText(""); 987var projectFile = persistentFolder.CreateOrOpenFile("Project1.csproj").WriteAllText(""); 992var documentFile = persistentFolder.CreateOrOpenFile("Document1.cs").WriteAllText("");
ProjectSystemShim\CPS\AnalyzersTests.cs (3)
26var ruleSetFile = Temp.CreateFile().WriteAllText( 50var ruleSetFile = Temp.CreateFile().WriteAllText( 74var ruleSetFile = Temp.CreateFile();
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (9)
30var ruleSetFile = Temp.CreateFile().WriteAllText( 53var ruleSetFile = Temp.CreateFile(); 67var ruleSetFile = Temp.CreateFile().WriteAllText( 95var ruleSetFile = Temp.CreateFile().WriteAllText( 119var ruleSetFile = Temp.CreateFile().WriteAllText( 143var ruleSetFile = Temp.CreateFile(); 161var ruleSetFile = Temp.CreateFile().WriteAllText( 196var ruleSetFile = Temp.CreateFile().WriteAllText( 232var ruleSetFile = Temp.CreateFile().WriteAllText(ruleSetSource);
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (3)
33var dllFile = dir.CreateFile("lib.dll"); 34var pdbFile = (pdbFormat == DebugInformationFormat.Embedded) ? null : dir.CreateFile("lib.pdb"); 83var dllFile = dir.CreateFile("lib.dll");
Roslyn.VisualStudio.Next.UnitTests (8)
Remote\SnapshotSerializationTests.cs (7)
424var file = tempRoot.CreateFile("shadow", "dll"); 445var file = tempRoot.CreateFile("shadow", "dll"); 482var file1 = dir.CreateFile("analyzer1.dll").CopyContentFrom(_testFixture.FaultyAnalyzer); 483var file2 = dir.CreateFile("analyzer2.dll").CopyContentFrom(_testFixture.FaultyAnalyzer); 566var tempCorlib = tempDir.CopyFile(mscorlibLocation); 567var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml")); 698var shadow = tempRoot.CreateFile("shadow", "dll");
Services\ServiceHubServicesTests.cs (1)
347var file = tempRoot.CreateDirectory().CreateFile("p1.dll");
VBCSCompiler.UnitTests (13)
AnalyzerConsistencyCheckerTests.cs (8)
44private TempFile CreateNetStandardDll(TempDirectory directory, string assemblyName, string version, ImmutableArray<byte> publicKey, string? extraSource = null) 71var file = directory.CreateFile($"{assemblyName}.dll"); 116var mvidAlpha1 = CreateNetStandardDll(directory.CreateDirectory("mvid1"), "MvidAlpha", "1.0.0.0", key, "class C { }"); 117var mvidAlpha2 = CreateNetStandardDll(directory.CreateDirectory("mvid2"), "MvidAlpha", "1.0.0.0", key, "class D { }"); 141var mvidAlpha1 = CreateNetStandardDll(directory, "MvidAlpha", "1.0.0.0", key, "class C { }"); 151var mvidAlpha2 = CreateNetStandardDll(directory, "MvidAlpha", "1.0.0.0", key, "class D { }"); 201var dllFile = directory.CreateFile("System.Core.dll"); 238var compFile = CreateNetStandardDll(directory, "netstandardRef", "1.0.0.0", key);
CompilerServerTests.cs (5)
114TempFile file = currentDirectory.CreateFile(pair.Key); 260private static void RunCompilerOutput(TempFile file, string expectedOutput) 1171var tempOut = _tempDirectory.CreateFile("output.txt"); 1305var rspFile = _tempDirectory.CreateFile("temp.rsp").WriteAllText( 1329var rspFile = _tempDirectory.CreateFile("temp.rsp").WriteAllText(