1 write to Path
Microsoft.Build.UnitTests.Shared (1)
TestEnvironment.cs (1)
772Path = folderPath ?? FileUtilities.GetTemporaryDirectory(createFolder, subfolder);
450 references to Path
Microsoft.Build.BuildCheck.UnitTests (32)
ConfigurationProvider_Tests.cs (10)
33var configs = configurationProvider.GetConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 55var configs = configurationProvider.GetConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 89var customConfiguration = configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 115var buildConfig = configurationProvider.GetUserConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 146configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 151configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.Path, "test123.csproj"), "rule_id"); 178configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 183configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.Path, "test123.csproj"), "rule_id"); 209configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.Path, "test.csproj"), "rule_id"); 214configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.Path, "test123.csproj"), "rule_id");
EditorConfigParser_Tests.cs (4)
66TransientTestFolder workFolder2 = testEnvironment.CreateFolder(Path.Combine(workFolder1.Path, "subfolder"), createFolder: true); 84var listOfEditorConfigFile = parser.DiscoverEditorConfigFiles(Path.Combine(workFolder1.Path, "subfolder", "projectfile.proj")).ToList(); 98TransientTestFolder workFolder2 = testEnvironment.CreateFolder(Path.Combine(workFolder1.Path, "subfolder"), createFolder: true); 113var listOfEditorConfigFile = parser.DiscoverEditorConfigFiles(Path.Combine(workFolder1.Path, "subfolder", "projectfile.proj")).ToList();
EndToEndTests.cs (17)
164CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.Path); 165ReplaceStringInFile(Path.Combine(workFolder.Path, referencedProjectName, $"{referencedProjectName}.csproj"), 168Path.Combine(workFolder.Path, referencedProjectName, "Resource1.resx"), 169Path.Combine(workFolder.Path, referencedProjectName, $"Resource1.{resourceExtension}.resx")); 171_env.SetCurrentDirectory(Path.Combine(workFolder.Path, entryProjectName)); 178string[] depsFiles = Directory.GetFiles(Path.Combine(workFolder.Path, entryProjectName), $"{entryProjectName}.deps.json", SearchOption.AllDirectories); 274CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.Path); 276_env.SetCurrentDirectory(Path.Combine(workFolder.Path, entryProjectName)); 386CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.Path); 387ReplaceStringInFile(Path.Combine(workFolder.Path, $"{projectName}.csproj"), 390_env.SetCurrentDirectory(workFolder.Path); 477_env.SetCurrentDirectory(workFolder.Path); 962File.Copy(nugetTemplatePath, Path.Combine(workFolder.Path, nugetTemplateName)); 963AddCustomDataSourceToNugetConfig(workFolder.Path); 976var creationLog = ExecuteDotnetCommand($"new {templateShortName} -n {projectName} --MicrosoftBuildVersion {BuildCheckUnitTestsConstants.MicrosoftBuildPackageVersion} -o {workFolder.Path} "); 978var buildLog = ExecuteDotnetCommand($"build {workFolder.Path}"); 1089.Replace("WorkFolderPath", workFolder.Path);
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
Microsoft.Build.CommandLine.UnitTests (27)
PerfLog_Tests.cs (5)
30testEnv.SetEnvironmentVariable("DOTNET_PERFLOG_DIR", perfLogFolder.Path); 42string projectPath = Path.Combine(projectFolder.Path, "ClassLibrary.csproj"); 52string[] files = Directory.GetFiles(perfLogFolder.Path, "perf-*.log"); 65string perfLogPath = Path.Combine(perfLogFolder.Path, "logs"); 78string projectPath = Path.Combine(projectFolder.Path, "ClassLibrary.csproj");
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
XMake_BinlogSwitch_Tests.cs (11)
43string binlogPath = Path.Combine(directory.Path, "test.binlog"); 62string binlogPath1 = Path.Combine(directory.Path, "test1.binlog"); 63string binlogPath2 = Path.Combine(directory.Path, "test2.binlog"); 85string binlogPattern = Path.Combine(directory.Path, "build-{}.binlog"); 92string[] binlogFiles = Directory.GetFiles(directory.Path, "build-*.binlog"); 93binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.Path}"); 111string binlogPattern = Path.Combine(directory.Path, "build-{}-test-{}.binlog"); 118string[] binlogFiles = Directory.GetFiles(directory.Path, "build-*-test-*.binlog"); 119binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.Path}"); 136string binlogPath = Path.Combine(directory.Path, "test.binlog"); 160string binlogPath = Path.Combine(directory.Path, "test.binlog");
XMake_Tests.cs (10)
1348string directory = _env.DefaultTestDirectory.Path; 1376env.SetCurrentDirectory(folder.Path); 1571var msbuildParameters = "\"" + directory.Path + "\""; 1615output.ShouldContain($"[A={directory.Path}{Path.DirectorySeparatorChar}]"); 2646var dllFilePath = Path.Combine(tempDir.Path, expectedLoggerName); 2755string binLogLocation = _env.DefaultTestDirectory.Path; 2778string binLogLocation = _env.DefaultTestDirectory.Path; 2817string binLogLocation = _env.DefaultTestDirectory.Path; 2857string binLogLocation = _env.DefaultTestDirectory.Path; 3240var tempLoggerProjDir = Path.Combine(tempDir.Path, "LoggerProject");
Microsoft.Build.Engine.OM.UnitTests (3)
Construction\ConstructionEditing_Tests.cs (1)
3210var testSdkRoot = env.CreateFolder().Path;
Definition\ProjectItem_Tests.cs (1)
452IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(itemDefinition.Replace("somedir", directory.Path), allItems: false, ignoreCondition: true);
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
Microsoft.Build.Engine.UnitTests (236)
BackEnd\BuildManager_Tests.cs (1)
4642string debugPath = _env.CreateFolder().Path;
BackEnd\BuildRequestConfiguration_Tests.cs (1)
566project.FullPath = _env.CreateFolder().Path;
BackEnd\IntrinsicTask_Tests.cs (2)
2525env.SetCurrentDirectory(projectDirectory.Path); 2535<i1 Remove='" + projectDirectory.Path + Path.DirectorySeparatorChar + @"*.tmp'/>
BackEnd\MSBuild_Tests.cs (2)
2016string projectDir = env.CreateFolder().Path; 2085string projectDir = env.CreateFolder().Path;
BackEnd\SdkResolverLoader_Tests.cs (9)
220var root = env.CreateFolder().Path; 245var root = env.CreateFolder().Path; 272var root = env.CreateFolder().Path; 296var root = env.CreateFolder().Path; 312var root = env.CreateFolder().Path; 339var testRoot = env.CreateFolder().Path; 367var testRoot = env.CreateFolder().Path; 368var additionalRoot = env.CreateFolder().Path; 442var testRoot = env.CreateFolder().Path;
BackEnd\SdkResultOutOfProc_Tests.cs (2)
105string projectFolder = _env.CreateFolder().Path; 140string projectFolder = _env.CreateFolder().Path;
BackEnd\TaskExecutionHost_Tests.cs (1)
1072var transientEnvVar = env.SetEnvironmentVariable("MSBUILDDEBUGPATH", debugFolder.Path);
BackEnd\TaskHost_MultiThreadableTask_Tests.cs (1)
33_testProjectsDir = _env.CreateFolder().Path;
BackEnd\TaskHostCallback_Tests.cs (4)
74string testDir = env.CreateFolder().Path; 219string testDir = env.CreateFolder().Path; 265string testDir = env.CreateFolder().Path; 321string testDir = env.CreateFolder().Path;
BackEnd\TaskRouter_IntegrationTests.cs (1)
40_testProjectsDir = _env.CreateFolder().Path;
BinaryLogger_Tests.cs (13)
345RunnerUtilities.ExecMSBuild($"{_logFile} -flp:logfile={Path.Combine(logFolder.Path, "logFile.log")};verbosity=diagnostic", out success); 348string text = File.ReadAllText(Path.Combine(logFolder.Path, "logFile.log")); 402RunnerUtilities.ExecMSBuild($"{projectFile.Path} -nr:False -bl:{_logFile} -flp1:logfile={Path.Combine(logFolder.Path, "logFile.log")};verbosity=diagnostic -flp2:logfile={Path.Combine(logFolder.Path, "logFile2.log")};verbosity=normal", out bool success); 407string text = File.ReadAllText(Path.Combine(logFolder.Path, "logFile.log")); 411string text2 = File.ReadAllText(Path.Combine(logFolder.Path, "logFile2.log")); 414RunnerUtilities.ExecMSBuild($"{_logFile} -flp1:logfile={Path.Combine(logFolder.Path, "logFile3.log")};verbosity=diagnostic -flp2:logfile={Path.Combine(logFolder.Path, "logFile4.log")};verbosity=normal", out success); 416text = File.ReadAllText(Path.Combine(logFolder.Path, "logFile3.log")); 420text2 = File.ReadAllText(Path.Combine(logFolder.Path, "logFile4.log")); 465string symlinkPath = Path.Combine(testFolder2.Path, symlinkName); 466string symlinkLvl2Path = Path.Combine(testFolder2.Path, symlinkLvl2Name); 552string logFilePath = Path.Combine(_env.DefaultTestDirectory.Path, "test.binlog");
CLR2TaskHost_E2E_Tests.cs (1)
59string projectPath = Path.Combine(testFolder.Path, "CLR2ExplicitTest.proj");
Construction\SolutionFile_OldParser_Tests.cs (3)
775env.CreateFolder(Path.Combine(solutionFolder.Path, "RelativePath")); 778p.FullPath = Path.Combine(solutionFolder.Path, "RelativePath", "project file"); 779p.SolutionFileDirectory = Path.GetFullPath(solutionFolder.Path);
Construction\SolutionFilter_Tests.cs (8)
54TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "ClassLibrary"), createFolder: true); 55TransientTestFolder classLibSubFolder = testEnvironment.CreateFolder(Path.Combine(classLibFolder.Path, "ClassLibrary"), createFolder: true); 64TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "SimpleProject"), createFolder: true); 65TransientTestFolder simpleProjectSubFolder = testEnvironment.CreateFolder(Path.Combine(simpleProjectFolder.Path, "SimpleProject"), createFolder: true); 232TransientTestFolder src = testEnvironment.CreateFolder(Path.Combine(folder.Path, "src"), createFolder: true); 293folder = testEnvironment.CreateFolder(Path.Combine(folder.Path, $"test@folder%special$symbols"), createFolder: true); 394TransientTestFolder src = testEnvironment.CreateFolder(Path.Combine(folder.Path, "src"), createFolder: true); 395TransientTestFolder nested = testEnvironment.CreateFolder(Path.Combine(src.Path, "nested"), createFolder: true);
Construction\SolutionProjectGenerator_Tests.cs (6)
122TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "classlib"), createFolder: true); 132TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "simpleProject"), createFolder: true); 167TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "classlib"), createFolder: true); 183TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "simpleProject"), createFolder: true); 242TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "classlib"), createFolder: true); 258TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.Path, "simpleProject"), createFolder: true);
Definition\ProjectEvaluationContext_Tests.cs (34)
123{Path.Combine(_env.DefaultTestDirectory.Path, "1.file"), 1}, 124{Path.Combine(_env.DefaultTestDirectory.Path, "2.file"), 1} 181{ _env.DefaultTestDirectory.Path, 1}, 182{ Path.Combine(_env.DefaultTestDirectory.Path, "1.file"), 2 } 187{ _env.DefaultTestDirectory.Path, 1 } 372var projectDirectory = _env.DefaultTestDirectory.Path; 431var projectDirectory1 = _env.DefaultTestDirectory.CreateDirectory("1").Path; 432var projectDirectory2 = _env.DefaultTestDirectory.CreateDirectory("2").Path; 482var project1Directory = project1Root.CreateDirectory("1").Path; 483var project1GlobDirectory = project1Root.CreateDirectory("Glob").CreateDirectory("1").Path; 486var project2Directory = project2Root.CreateDirectory("2").Path; 487var project2GlobDirectory = project2Root.CreateDirectory("Glob").CreateDirectory("2").Path; 547var project1GlobDirectory = project1Directory.CreateDirectory("Glob").CreateDirectory("1").Path; 562Path.Combine(project1Directory.Path, "1"), 570Path.Combine(project2Directory.Path, "2"), 573<i Include=`{Path.Combine(project1Directory.Path, "Glob", "**", "*.cs")}` /> 591.Select(i => Path.Combine(project1Directory.Path, i)) 622File.WriteAllText(Path.Combine(globDirectory.Path, $"{evaluationCount}.cs"), ""); 628Path.Combine(project1Directory.Path, "1"), 635Path.Combine(project2Directory.Path, "2"), 660File.WriteAllText(Path.Combine(globDirectory.Path, $"{evaluationCount}.cs"), ""); 687: globDirectory.Path; 689Directory.CreateDirectory(globDirectory.Path); 720.Select((p, i) => new ProjectSpecification(Path.Combine(testDirectory.Path, $"ProjectDirectory{i}", $"Project{i}.proj"), p)); 726File.WriteAllText(Path.Combine(globDirectory.Path, $"{evaluationCount}.cs"), ""); 736File.WriteAllText(Path.Combine(globDirectory.Path, $"{evaluationCount}.cs"), ""); 757var projectDirectory = _env.DefaultTestDirectory.Path; 800var projectDirectory = _env.DefaultTestDirectory.Path; 862<SearchedPath>$([MSBuild]::GetDirectoryNameOfFileAbove('{subdirectory.Path}', 'a'))</SearchedPath> 876searchedPath.EvaluatedValue.ShouldBe(subdirectory.Path); 882? subdirectory.Path 883: _env.DefaultTestDirectory.Path); 918<SearchedPath>$([MSBuild]::GetPathOfFileAbove('a', '{subdirectory.Path}'))</SearchedPath> 958projectContents.Select((p, i) => new ProjectSpecification(Path.Combine(_env.DefaultTestDirectory.Path, $"Project{i}.proj"), p)),
Evaluation\Evaluator_Tests.cs (1)
80<Import {importParameter.Replace("realFolder", existentDirectory.Path)} />
Evaluation\Expander_Tests.cs (114)
4915includes.ShouldContain(root.Path); 4916includes.ShouldContain(alpha.Path); 4917includes.ShouldContain(beta.Path); 4918includes.ShouldNotContain(gamma.Path); 4959includes.ShouldContain(root.Path); 4960includes.ShouldContain(alpha.Path); 4961includes.ShouldContain(beta.Path); 4962includes.ShouldContain(gamma.Path); 5377File.WriteAllText(Path.Combine(correctDir.Path, "notes.txt"), "correct content"); 5378File.WriteAllText(Path.Combine(wrongDir.Path, "notes.txt"), "wrong content"); 5381"$([System.IO.File]::ReadAllText('notes.txt'))", correctDir.Path, wrongDir.Path); 5393File.WriteAllText(Path.Combine(correctDir.Path, "exists.txt"), "data"); 5397"$([System.IO.File]::Exists('exists.txt'))", correctDir.Path, wrongDir.Path); 5409string filePath = Path.Combine(correctDir.Path, "attrs.txt"); 5414correctDir.Path, wrongDir.Path); 5427string filePath = Path.Combine(correctDir.Path, "time.txt"); 5432"$([System.IO.File]::GetCreationTime('time.txt'))", correctDir.Path, wrongDir.Path); 5444string filePath = Path.Combine(correctDir.Path, "time.txt"); 5449"$([System.IO.File]::GetLastWriteTime('time.txt'))", correctDir.Path, wrongDir.Path); 5461string filePath = Path.Combine(correctDir.Path, "time.txt"); 5466"$([System.IO.File]::GetLastAccessTime('time.txt'))", correctDir.Path, wrongDir.Path); 5482Directory.CreateDirectory(Path.Combine(correctDir.Path, "subdir")); 5486"$([System.IO.Directory]::Exists('subdir'))", correctDir.Path, wrongDir.Path); 5498Directory.CreateDirectory(Path.Combine(correctDir.Path, "parent", "child")); 5501@"$([System.IO.Directory]::GetParent('parent\child'))", correctDir.Path, wrongDir.Path); 5514string subDir = Path.Combine(correctDir.Path, "sub"); 5519"$([System.IO.Directory]::GetFiles('sub'))", correctDir.Path, wrongDir.Path); 5532Directory.CreateDirectory(Path.Combine(correctDir.Path, "parent", "child")); 5535"$([System.IO.Directory]::GetDirectories('parent'))", correctDir.Path, wrongDir.Path); 5547string subDir = Path.Combine(correctDir.Path, "sub"); 5552"$([System.IO.Directory]::GetLastWriteTime('sub'))", correctDir.Path, wrongDir.Path); 5564string subDir = Path.Combine(correctDir.Path, "sub"); 5569"$([System.IO.Directory]::GetLastAccessTime('sub'))", correctDir.Path, wrongDir.Path); 5586File.WriteAllText(Path.Combine(correctDir.Path, "lines.txt"), "line1\nline2"); 5587File.WriteAllText(Path.Combine(wrongDir.Path, "lines.txt"), "wrong"); 5590"$([System.IO.File]::ReadAllLines('lines.txt'))", correctDir.Path, wrongDir.Path); 5603File.WriteAllBytes(Path.Combine(correctDir.Path, "data.bin"), [0x42]); 5606"$([System.IO.File]::ReadAllBytes('data.bin'))", correctDir.Path, wrongDir.Path); 5620"$([System.IO.File]::WriteAllText('output.txt', 'hello'))", correctDir.Path, wrongDir.Path); 5622File.Exists(Path.Combine(correctDir.Path, "output.txt")).ShouldBeTrue(); 5623File.ReadAllText(Path.Combine(correctDir.Path, "output.txt")).ShouldBe("hello"); 5624File.Exists(Path.Combine(wrongDir.Path, "output.txt")).ShouldBeFalse(); 5635File.WriteAllText(Path.Combine(correctDir.Path, "append.txt"), "base"); 5638"$([System.IO.File]::AppendAllText('append.txt', ' added'))", correctDir.Path, wrongDir.Path); 5640File.ReadAllText(Path.Combine(correctDir.Path, "append.txt")).ShouldBe("base added"); 5651string correctFile = Path.Combine(correctDir.Path, "todelete.txt"); 5652string wrongFile = Path.Combine(wrongDir.Path, "todelete.txt"); 5657"$([System.IO.File]::Delete('todelete.txt'))", correctDir.Path, wrongDir.Path); 5671string filePath = Path.Combine(correctDir.Path, "utc.txt"); 5676"$([System.IO.File]::GetCreationTimeUtc('utc.txt'))", correctDir.Path, wrongDir.Path); 5689string filePath = Path.Combine(correctDir.Path, "utc.txt"); 5694"$([System.IO.File]::GetLastWriteTimeUtc('utc.txt'))", correctDir.Path, wrongDir.Path); 5707string filePath = Path.Combine(correctDir.Path, "utc.txt"); 5712"$([System.IO.File]::GetLastAccessTimeUtc('utc.txt'))", correctDir.Path, wrongDir.Path); 5730"$([System.IO.Directory]::CreateDirectory('newdir'))", correctDir.Path, wrongDir.Path); 5732Directory.Exists(Path.Combine(correctDir.Path, "newdir")).ShouldBeTrue(); 5733Directory.Exists(Path.Combine(wrongDir.Path, "newdir")).ShouldBeFalse(); 5744Directory.CreateDirectory(Path.Combine(correctDir.Path, "todel")); 5745Directory.CreateDirectory(Path.Combine(wrongDir.Path, "todel")); 5748"$([System.IO.Directory]::Delete('todel'))", correctDir.Path, wrongDir.Path); 5750Directory.Exists(Path.Combine(correctDir.Path, "todel")).ShouldBeFalse(); 5751Directory.Exists(Path.Combine(wrongDir.Path, "todel")).ShouldBeTrue(); 5764string filePath = Path.Combine(dir.Path, "abs.txt"); 5780string filePath = Path.Combine(dir.Path, "abs.txt"); 5795string subDir = Path.Combine(dir.Path, "subdir"); 5815string absFile = Path.Combine(otherDir.Path, "abs.txt"); 5820$"$([System.IO.File]::ReadAllText('{absFile}'))", correctDir.Path); 5832string absFile = Path.Combine(otherDir.Path, "abs.txt"); 5836$"$([System.IO.File]::Exists('{absFile}'))", correctDir.Path); 5853File.WriteAllText(Path.Combine(correctDir.Path, "source.txt"), "copy me"); 5856"$([System.IO.File]::Copy('source.txt', 'dest.txt'))", correctDir.Path, wrongDir.Path); 5858File.Exists(Path.Combine(correctDir.Path, "dest.txt")).ShouldBeTrue(); 5859File.ReadAllText(Path.Combine(correctDir.Path, "dest.txt")).ShouldBe("copy me"); 5860File.Exists(Path.Combine(wrongDir.Path, "dest.txt")).ShouldBeFalse(); 5871File.WriteAllText(Path.Combine(correctDir.Path, "movesrc.txt"), "move me"); 5874"$([System.IO.File]::Move('movesrc.txt', 'movedst.txt'))", correctDir.Path, wrongDir.Path); 5876File.Exists(Path.Combine(correctDir.Path, "movesrc.txt")).ShouldBeFalse(); 5877File.Exists(Path.Combine(correctDir.Path, "movedst.txt")).ShouldBeTrue(); 5878File.ReadAllText(Path.Combine(correctDir.Path, "movedst.txt")).ShouldBe("move me"); 5889Directory.CreateDirectory(Path.Combine(correctDir.Path, "dirsrc")); 5892"$([System.IO.Directory]::Move('dirsrc', 'dirdst'))", correctDir.Path, wrongDir.Path); 5894Directory.Exists(Path.Combine(correctDir.Path, "dirsrc")).ShouldBeFalse(); 5895Directory.Exists(Path.Combine(correctDir.Path, "dirdst")).ShouldBeTrue(); 5910string siblingDir = Path.Combine(rootDir.Path, "sibling"); 5911string subDir = Path.Combine(rootDir.Path, "subdir"); 5917@"$([System.IO.File]::ReadAllText('../sibling/file.txt'))", subDir, wrongDir.Path); 5933string siblingDir = Path.Combine(rootDir.Path, "sibling"); 5934string subDir = Path.Combine(rootDir.Path, "subdir"); 5941@"$([System.IO.File]::ReadAllText('..\\sibling\\file.txt'))", subDir, wrongDir.Path);
Evaluation\IntrinsicFunctionOverload_Tests.cs (3)
133string testFilePath = Path.Combine(env.DefaultTestDirectory.Path, "TestFile.txt"); 173string testDirPath = Path.Combine(env.DefaultTestDirectory.Path, "TestDir"); 214string testDirPath = Path.Combine(env.DefaultTestDirectory.Path, "TestDir");
Evaluation\Preprocessor_Tests.cs (4)
850string testSdkDirectory = env.CreateFolder().Path; 941string testDirectory = env.CreateFolder().Path; 1056string sdk1 = env.CreateFolder().Path; 1057string sdk2 = env.CreateFolder().Path;
Evaluation\ProjectSdkImplicitImport_Tests.cs (2)
88_testSdkRoot = _env.CreateFolder().Path; 354var projectFolder = _env.CreateFolder().Path;
Evaluation\SdkResultEvaluation_Tests.cs (1)
41_testFolder = _env.CreateFolder().Path;
Graph\GetCompatiblePlatformGraph_Tests.cs (6)
354TransientTestFolder project1Folder = testEnvironment.CreateFolder(Path.Combine(folder.Path, firstProjectName), createFolder: true); 355TransientTestFolder project1SubFolder = testEnvironment.CreateFolder(Path.Combine(project1Folder.Path, firstProjectName), createFolder: true); 369TransientTestFolder project2Folder = testEnvironment.CreateFolder(Path.Combine(folder.Path, secondProjectName), createFolder: true); 370TransientTestFolder project2SubFolder = testEnvironment.CreateFolder(Path.Combine(project2Folder.Path, secondProjectName), createFolder: true); 380TransientTestFolder project3Folder = testEnvironment.CreateFolder(Path.Combine(folder.Path, thirdProjectName), createFolder: true); 381TransientTestFolder project3SubFolder = testEnvironment.CreateFolder(Path.Combine(project3Folder.Path, thirdProjectName), createFolder: true);
Graph\ProjectGraph_Tests.cs (8)
844string project1Path = Path.Combine(env.DefaultTestDirectory.Path, "Project1.csproj"); 845string project2Path = Path.Combine(env.DefaultTestDirectory.Path, "Project2.vcxproj"); 846string project3Path = Path.Combine(env.DefaultTestDirectory.Path, "Project3.vcxproj"); 847string project4Path = Path.Combine(env.DefaultTestDirectory.Path, "Project4.vcxproj"); 848string project5Path = Path.Combine(env.DefaultTestDirectory.Path, "Project5.vcxproj"); 849string project6Path = Path.Combine(env.DefaultTestDirectory.Path, "Project6.wapproj"); 850string project7Path = Path.Combine(env.DefaultTestDirectory.Path, "Project7.csproj"); 851string project8Path = Path.Combine(env.DefaultTestDirectory.Path, "Project8.csproj");
MSBuildTaskHostTests.cs (2)
34CopyFilesRecursively(Path.Combine(TestAssetsRootPath, "Net35WinFormsApp"), testFolder.Path); 35string projectFilePath = Path.Combine(testFolder.Path, "TestNet35WinForms.csproj");
ProjectCache\ProjectCacheTests.cs (1)
1737string appDllPath = Path.Combine(directory.Path, $"bin/{s_currentTargetNETFramework}/app.dll");
TerminalLogger_Tests.cs (2)
919RunnerUtilities.ExecMSBuild($"{projectFile.Path} /bl:{logFileWithTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithTL.log")};verbosity=diagnostic -tl:on", out bool success, outputHelper: _outputHelper); 923RunnerUtilities.ExecMSBuild($"{projectFile.Path} /bl:{logFileWithoutTL} -flp:logfile={Path.Combine(logFolder.Path, "logFileWithoutTL.log")};verbosity=diagnostic", out success, outputHelper: _outputHelper);
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
TypeLoader_Tests.cs (2)
105string newAssemblyLocation = Path.Combine(folder.Path, Path.GetFileName(currentAssembly)); 110File.Copy(utilities, Path.Combine(folder.Path, utilitiesName));
Microsoft.Build.Framework.UnitTests (8)
FileMatcher_Tests.cs (7)
65File.WriteAllBytes(Path.Combine(testFolder.Path, file), new byte[1]); 68string[] fileMatches = FileMatcher.Default.GetFiles(testFolder.Path, pattern).FileList; 104foreach (string fullPath in GetFilesComplexGlobbingMatchingInfo.FilesToCreate.Select(i => Path.Combine(testFolder.Path, i.ToPlatformSlash()))) 113string[] matchedFiles = fileMatcher.GetFiles(testFolder.Path, include, excludes?.ToList()).FileList; 1249string workingPath = _env.CreateFolder().Path; 1263string workingPath = _env.CreateFolder().Path; 1280string workingPath = _env.CreateFolder().Path;
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
Microsoft.Build.Tasks.UnitTests (110)
AddToWin32Manifest_Tests.cs (3)
44var tempOutput = env.CreateFolder().Path; 82var outputPath = env.CreateFolder().Path; 109File.Copy(Path.Combine(TestAssetsRootPath, manifestName), Path.Combine(projectFolder.Path, manifestName));
Copy_Tests.cs (16)
178DestinationFolder = new TaskItem(destinationFolder.Path), 221SourceFolders = new ITaskItem[] { new TaskItem(s0Folder.Path), new TaskItem(s1Folder.Path) }, 222DestinationFolder = new TaskItem(destinationFolder.Path), 231Directory.Exists(Path.Combine(destinationFolder.Path, "source0")).ShouldBeTrue(); 232Directory.Exists(Path.Combine(destinationFolder.Path, "source1")).ShouldBeTrue(); 248DestinationFolder = new TaskItem(destinationFolder.Path), 279SourceFolders = new ITaskItem[] { new TaskItem(sourceFolder.Path) }, 280DestinationFolder = new TaskItem(destinationFolder.Path), 305DestinationFolder = new TaskItem(destinationFolder.Path), 330DestinationFolder = new TaskItem(destinationFolder.Path), 381DestinationFolder = new TaskItem(destinationFolder.Path), 405SourceFolders = new ITaskItem[] { new TaskItem(sourceFolder.Path) }, 1127var sourceFile = FileUtilities.GetTemporaryFile(env.DefaultTestDirectory.Path, null, "src", false); 1128var destinationFile = FileUtilities.GetTemporaryFile(env.DefaultTestDirectory.Path, null, "dst", false); 3009string destFile = Path.Combine(destFolder.Path, "The Destination");
CreateCSharpManifestResourceName_Tests.cs (1)
460env.SetCurrentDirectory(env.DefaultTestDirectory.Path);
DownloadFile_Tests.cs (9)
38DestinationFolder = new TaskItem(folder.Path), 68DestinationFolder = new TaskItem(folder.Path), 79FileInfo file = new FileInfo(Path.Combine(folder.Path, "foo.txt")); 117DestinationFolder = new TaskItem(folder.Path), 125FileInfo file = new FileInfo(Path.Combine(folder.Path, filename)); 148DestinationFolder = new TaskItem(folder.Path), 160FileInfo file = new FileInfo(Path.Combine(folder.Path, filename)); 216DestinationFolder = new TaskItem(folder.Path), 332DestinationFolder = new TaskItem(folder.Path),
GenerateBindingRedirects_Tests.cs (1)
268TransientTestFolder testFolder = env.CreateFolder(Path.Combine(rootTestFolder.Path, "\uD873\uDD02\u9FA8\u82D8\u722B\u9EA4\u03C5\u33D1\uE038\u486B\u0033"));
GetReferencePaths_Tests.cs (4)
302string frameworkRootDir = Path.Combine(env.DefaultTestDirectory.Path, "framework-root"); 304var redistListDirectory = env.CreateFolder(Path.Combine(framework41Directory.Path, "RedistList")); 319getReferencePaths.RootPath = env.CreateFolder().Path; 326Assert.Equal(framework41Directory.Path, returnedPaths[0]);
GetSDKReference_Tests.cs (2)
277GetSDKReferenceFiles.SDKFilesCache cache = new(null, folder.Path, null, null, null); 279GetSDKReferenceFiles.SDKFilesCache cache2 = new(null, folder.Path, null, null, null);
HintPathResolver_Tests.cs (1)
45var longTempFilePath = tempfolder.Path + "\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\..\\tempfolder_for_CanResolveLongHintPath\\FakeSystem.Net.Http.dll";
MSBuildInternalMessage_Tests.cs (5)
27var outputPath = env.CreateFolder().Path; 72var outputPath = env.CreateFolder().Path; 118var outputPath = env.CreateFolder().Path; 196var outputPath = env.CreateFolder().Path; 250var outputPath = env.CreateFolder().Path;
PortableTasks_Tests.cs (1)
50var folder = env.CreateFolder().Path;
RemoveDir_Tests.cs (1)
57list.Add(new TaskItem(env.CreateFolder().Path));
ResolveAssemblyReference_CustomCultureTests.cs (2)
46var solutionPath = solutionFolder.Path; 50var projBOutputPath = env.CreateFolder().Path;
ResourceHandling\GenerateResource_Tests.cs (2)
3937env.SetCurrentDirectory(env.DefaultTestDirectory.Path); 3943env.CreateFolder(Path.Combine(env.DefaultTestDirectory.Path, "tmp_dir")),
ResourceHandling\MSBuildResXReader_Tests.cs (1)
179Path.Combine(baseDir.Path, nameof(LoadsStringFromFileRefAsStringWithShiftJISEncoding) + ".resx"),
ResourceHandling\ResGenDependencies_Tests.cs (2)
125string bitmapPath = Path.Combine(folder.Path, "linked.bmp"); 134string resxPath = Path.Combine(folder.Path, "test.resx");
RoslynCodeTaskFactory_Tests.cs (9)
128string output = RunnerUtilities.ExecMSBuild(assemblyProj.Path + $" /p:OutDir={Path.Combine(folder.Path, "subFolder")} /restore", out bool success); 136<Reference Include=""{Path.Combine(folder.Path, "subFolder", "5106.dll")}"" /> 1189TransientTestFolder project1Folder = env.CreateFolder(Path.Combine(rootFolder.Path, "Project1"), createFolder: true); 1190TransientTestFolder project2Folder = env.CreateFolder(Path.Combine(rootFolder.Path, "Project2"), createFolder: true); 1281string projectFilePath = Path.Combine(testFolder.Path, "test.proj"); 1331string projectFilePath = Path.Combine(projectFolder.Path, "test.proj"); 1376TransientTestFolder projectFolder = env.CreateFolder(Path.Combine(rootFolder.Path, "Project"), createFolder: true); 1377string projectFilePath = Path.Combine(projectFolder.Path, "test.proj"); 1493string projectFilePath = Path.Combine(testFolder.Path, "test.proj");
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
Unzip_Tests.cs (34)
38DestinationFolder = new TaskItem(source.Path), 67DestinationFolder = new TaskItem(destination.Path), 81DestinationFolder = new TaskItem(destination.Path), 90_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log); 91_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log); 97DestinationFolder = new TaskItem(destination.Path), 127DestinationFolder = new TaskItem(destination.Path), 136_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log); 137_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log); 138_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "subdir", "F83E9633685494E53BEF3794EDEEE6A6.txt"), customMessage: _mockEngine.Log); 139_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "subdir", "21D6D4596067723B3AC5DF9A8B3CBFE7.txt"), customMessage: _mockEngine.Log); 140Directory.Exists(Path.Combine(destination.Path, "emptyDir")); 197DestinationFolder = new TaskItem(source.Path), 222DestinationFolder = new TaskItem(folder.Path), 243DestinationFolder = new TaskItem(folder.Path), 244SourceFiles = new ITaskItem[] { new TaskItem(Path.Combine(testEnvironment.DefaultTestDirectory.Path, "foo.zip")), }, 269DestinationFolder = new TaskItem(destination.Path), 279_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log); 280_mockEngine.Log.ShouldNotContain(Path.Combine(destination.Path, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log); 299DestinationFolder = new TaskItem(destination.Path), 309_mockEngine.Log.ShouldNotContain(Path.Combine(destination.Path, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log); 310_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log); 333DestinationFolder = new TaskItem(destination.Path), 344_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "file1.js"), customMessage: _mockEngine.Log); 345_mockEngine.Log.ShouldNotContain(Path.Combine(destination.Path, "file1.js.map"), customMessage: _mockEngine.Log); 346_mockEngine.Log.ShouldContain(Path.Combine(destination.Path, "file2.js"), customMessage: _mockEngine.Log); 347_mockEngine.Log.ShouldNotContain(Path.Combine(destination.Path, "readme.txt"), customMessage: _mockEngine.Log); 348_mockEngine.Log.ShouldNotContain(Path.Combine(destination.Path, "sub", "subfile.js"), customMessage: _mockEngine.Log); 367DestinationFolder = new TaskItem(destination.Path), 396DestinationFolder = new TaskItem(destination.Path), 425DestinationFolder = new TaskItem(destination.Path), 454DestinationFolder = new TaskItem(destination.Path), 489DestinationFolder = new TaskItem(destination.Path), 496string unzippedFilePath = Path.Combine(destination.Path, executableName);
WriteCodeFragment_Tests.cs (4)
109TaskItem folder = new TaskItem(env.CreateFolder(folderPath: null, createFolder: false).Path); 132TaskItem file = new TaskItem(Path.Combine(env.CreateFolder(folderPath: null, createFolder: false).Path, "File.tmp")); 411TaskItem folder = new TaskItem(env.CreateFolder(folderPath: null, createFolder: false).Path); 433string absoluteFolder = env.CreateFolder().Path;
WriteLinesToFile_Tests.cs (5)
320var file = Path.Combine(directory.Path, $"{Guid.NewGuid().ToString("N")}.tmp"); 331Directory.Exists(directory.Path).ShouldBeFalse(); 335Directory.Exists(directory.Path).ShouldBeTrue(); 399var outputFile = Path.Combine(testEnv.DefaultTestDirectory.Path, "output.txt"); 460var outputFile = Path.Combine(testEnv.DefaultTestDirectory.Path, "output.txt");
ZipDirectory_Tests.cs (6)
47string zipFilePath = Path.Combine(testEnvironment.CreateFolder(createFolder: true).Path, "test.zip"); 54SourceDirectory = new TaskItem(sourceFolder.Path), 60_mockEngine.Log.ShouldContain(sourceFolder.Path, customMessage: _mockEngine.Log); 113SourceDirectory = new TaskItem(sourceFolder.Path), 119_mockEngine.Log.ShouldContain(sourceFolder.Path, customMessage: _mockEngine.Log); 151SourceDirectory = new TaskItem(folder.Path),
Microsoft.Build.UnitTests.Shared (20)
EngineTestEnvironment.cs (1)
113public string TestRoot => _folder.Path;
TestEnvironment.cs (19)
202return SetTempPath(folder.Path, true); 211return WithTransientTestState(SetTempPath(folder.Path, true)); 242return WithTransientTestState(new TransientTestFile(transientTestFolder.Path, fileName, contents)); 253return WithTransientTestState(new TransientTestFile(transientTestFolder.Path, extension, 276return WithTransientTestState(new TransientTestFile(transientTestFolder.Path, extension, 309Assert.True(!(createFolder ^ FileSystems.Default.DirectoryExists(folder.Path))); 776Directory.CreateDirectory(Path); 782return new TransientTestFolder(System.IO.Path.Combine(Path, directoryName)); 787return new TransientTestFile(Path, fileName, contents); 796Path.ShouldNotBeNullOrEmpty(); 797Path.ShouldNotBe(@"\"); 798Path.ShouldNotBe(@"/"); 799System.IO.Path.GetFullPath(Path).ShouldNotBe(System.IO.Path.GetFullPath(System.IO.Path.GetTempPath())); 800System.IO.Path.IsPathRooted(Path).ShouldBeTrue($"{Path} is not rooted"); 802FileUtilities.DeleteDirectoryNoThrow(Path, true); 852Directory.CreateDirectory(destination.Path); 854string path = System.IO.Path.Combine(destination.Path, filename); 856ZipFile.CreateFromDirectory(source.Path, path);
Microsoft.Build.Utilities.UnitTests (14)
TestAssemblyInfo.cs (1)
87_testEnvironment.SetTempPath(assemblyTempFolder.Path);
ToolLocationHelper_Tests.cs (12)
2501string rootDir = Path.Combine(env.DefaultTestDirectory.Path, "framework-root"); 2530string customFrameworkRootPath = Path.Combine(env.DefaultTestDirectory.Path, "framework-root"); 2553string rootDir = Path.Combine(env.CreateFolder().Path, "framework-root"); 2554string fallbackPath = Path.Combine(env.CreateFolder().Path, "framework-root"); 2584string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root"); 2597string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root"); 2599string rootDir = env.CreateFolder().Path; 2614string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root"); 2631string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root"); 2646string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root"); 2648string rootDir = env.CreateFolder().Path; 2663string customFrameworkDirToUse = Path.Combine(env.CreateFolder().Path, "framework-root");
ToolTask_Tests.cs (1)
726string tempDirectory = env.CreateFolder().Path;