1 write to Path
Microsoft.Build.UnitTests.Shared (1)
TestEnvironment.cs (1)
781
Path
= folderPath ?? FileUtilities.GetTemporaryDirectory(createFolder, subfolder);
449 references to Path
Microsoft.Build.BuildCheck.UnitTests (28)
ConfigurationProvider_Tests.cs (10)
33
var configs = configurationProvider.GetConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
55
var configs = configurationProvider.GetConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
89
var customConfiguration = configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
115
var buildConfig = configurationProvider.GetUserConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
146
configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
151
configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.
Path
, "test123.csproj"), "rule_id");
178
configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
183
configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.
Path
, "test123.csproj"), "rule_id");
209
configurationProvider.GetCustomConfiguration(Path.Combine(workFolder1.
Path
, "test.csproj"), "rule_id");
214
configurationProvider.CheckCustomConfigurationDataValidity(Path.Combine(workFolder1.
Path
, "test123.csproj"), "rule_id");
EditorConfigParser_Tests.cs (4)
66
TransientTestFolder workFolder2 = testEnvironment.CreateFolder(Path.Combine(workFolder1.
Path
, "subfolder"), createFolder: true);
84
var listOfEditorConfigFile = parser.DiscoverEditorConfigFiles(Path.Combine(workFolder1.
Path
, "subfolder", "projectfile.proj")).ToList();
98
TransientTestFolder workFolder2 = testEnvironment.CreateFolder(Path.Combine(workFolder1.
Path
, "subfolder"), createFolder: true);
113
var listOfEditorConfigFile = parser.DiscoverEditorConfigFiles(Path.Combine(workFolder1.
Path
, "subfolder", "projectfile.proj")).ToList();
EndToEndTests.cs (13)
163
CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.
Path
);
164
ReplaceStringInFile(Path.Combine(workFolder.
Path
, referencedProjectName, $"{referencedProjectName}.csproj"),
167
Path.Combine(workFolder.
Path
, referencedProjectName, "Resource1.resx"),
168
Path.Combine(workFolder.
Path
, referencedProjectName, $"Resource1.{resourceExtension}.resx"));
170
_env.SetCurrentDirectory(Path.Combine(workFolder.
Path
, entryProjectName));
177
string[] depsFiles = Directory.GetFiles(Path.Combine(workFolder.
Path
, entryProjectName), $"{entryProjectName}.deps.json", SearchOption.AllDirectories);
273
CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.
Path
);
275
_env.SetCurrentDirectory(Path.Combine(workFolder.
Path
, entryProjectName));
385
CopyFilesRecursively(Path.Combine(TestAssetsRootPath, testAssetsFolderName), workFolder.
Path
);
386
ReplaceStringInFile(Path.Combine(workFolder.
Path
, $"{projectName}.csproj"),
389
_env.SetCurrentDirectory(workFolder.
Path
);
476
_env.SetCurrentDirectory(workFolder.
Path
);
1088
.Replace("WorkFolderPath", workFolder.
Path
);
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
Microsoft.Build.CommandLine.UnitTests (27)
PerfLog_Tests.cs (5)
29
testEnv.SetEnvironmentVariable("DOTNET_PERFLOG_DIR", perfLogFolder.
Path
);
41
string projectPath = Path.Combine(projectFolder.
Path
, "ClassLibrary.csproj");
51
string[] files = Directory.GetFiles(perfLogFolder.
Path
, "perf-*.log");
64
string perfLogPath = Path.Combine(perfLogFolder.
Path
, "logs");
77
string projectPath = Path.Combine(projectFolder.
Path
, "ClassLibrary.csproj");
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
XMake_BinlogSwitch_Tests.cs (11)
42
string binlogPath = Path.Combine(directory.
Path
, "test.binlog");
61
string binlogPath1 = Path.Combine(directory.
Path
, "test1.binlog");
62
string binlogPath2 = Path.Combine(directory.
Path
, "test2.binlog");
84
string binlogPattern = Path.Combine(directory.
Path
, "build-{}.binlog");
91
string[] binlogFiles = Directory.GetFiles(directory.
Path
, "build-*.binlog");
92
binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.
Path
}");
110
string binlogPattern = Path.Combine(directory.
Path
, "build-{}-test-{}.binlog");
117
string[] binlogFiles = Directory.GetFiles(directory.
Path
, "build-*-test-*.binlog");
118
binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.
Path
}");
135
string binlogPath = Path.Combine(directory.
Path
, "test.binlog");
159
string binlogPath = Path.Combine(directory.
Path
, "test.binlog");
XMake_Tests.cs (10)
1346
string directory = _env.DefaultTestDirectory.
Path
;
1374
env.SetCurrentDirectory(folder.
Path
);
1569
var msbuildParameters = "\"" + directory.
Path
+ "\"";
1613
output.ShouldContain($"[A={directory.
Path
}{Path.DirectorySeparatorChar}]");
2644
var dllFilePath = Path.Combine(tempDir.
Path
, expectedLoggerName);
2753
string binLogLocation = _env.DefaultTestDirectory.
Path
;
2776
string binLogLocation = _env.DefaultTestDirectory.
Path
;
2815
string binLogLocation = _env.DefaultTestDirectory.
Path
;
2855
string binLogLocation = _env.DefaultTestDirectory.
Path
;
3238
var tempLoggerProjDir = Path.Combine(tempDir.
Path
, "LoggerProject");
Microsoft.Build.Engine.OM.UnitTests (3)
Construction\ConstructionEditing_Tests.cs (1)
3210
var testSdkRoot = env.CreateFolder().
Path
;
Definition\ProjectItem_Tests.cs (1)
452
IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(itemDefinition.Replace("somedir", directory.
Path
), allItems: false, ignoreCondition: true);
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
Microsoft.Build.Engine.UnitTests (237)
BackEnd\BuildManager_Tests.cs (1)
4641
string debugPath = _env.CreateFolder().
Path
;
BackEnd\BuildRequestConfiguration_Tests.cs (1)
565
project.FullPath = _env.CreateFolder().
Path
;
BackEnd\IntrinsicTask_Tests.cs (2)
2525
env.SetCurrentDirectory(projectDirectory.
Path
);
2535
<i1 Remove='" + projectDirectory.
Path
+ Path.DirectorySeparatorChar + @"*.tmp'/>
BackEnd\MSBuild_Tests.cs (2)
2015
string projectDir = env.CreateFolder().
Path
;
2084
string projectDir = env.CreateFolder().
Path
;
BackEnd\SdkResolverLoader_Tests.cs (9)
219
var root = env.CreateFolder().
Path
;
244
var root = env.CreateFolder().
Path
;
271
var root = env.CreateFolder().
Path
;
295
var root = env.CreateFolder().
Path
;
311
var root = env.CreateFolder().
Path
;
338
var testRoot = env.CreateFolder().
Path
;
366
var testRoot = env.CreateFolder().
Path
;
367
var additionalRoot = env.CreateFolder().
Path
;
441
var testRoot = env.CreateFolder().
Path
;
BackEnd\SdkResultOutOfProc_Tests.cs (2)
104
string projectFolder = _env.CreateFolder().
Path
;
139
string projectFolder = _env.CreateFolder().
Path
;
BackEnd\TaskExecutionHost_Tests.cs (1)
1069
var transientEnvVar = env.SetEnvironmentVariable("MSBUILDDEBUGPATH", debugFolder.
Path
);
BackEnd\TaskHost_MultiThreadableTask_Tests.cs (1)
32
_testProjectsDir = _env.CreateFolder().
Path
;
BackEnd\TaskHostCallback_Tests.cs (5)
72
string testDir = env.CreateFolder().
Path
;
179
string testDir = env.CreateFolder().
Path
;
225
string testDir = env.CreateFolder().
Path
;
281
string testDir = env.CreateFolder().
Path
;
492
string testDir = env.CreateFolder().
Path
;
BackEnd\TaskRouter_IntegrationTests.cs (1)
39
_testProjectsDir = _env.CreateFolder().
Path
;
BinaryLogger_Tests.cs (13)
355
RunnerUtilities.ExecMSBuild($"{_logFile} -flp:logfile={Path.Combine(logFolder.
Path
, "logFile.log")};verbosity=diagnostic", out success);
358
string text = File.ReadAllText(Path.Combine(logFolder.
Path
, "logFile.log"));
412
RunnerUtilities.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);
417
string text = File.ReadAllText(Path.Combine(logFolder.
Path
, "logFile.log"));
421
string text2 = File.ReadAllText(Path.Combine(logFolder.
Path
, "logFile2.log"));
424
RunnerUtilities.ExecMSBuild($"{_logFile} -flp1:logfile={Path.Combine(logFolder.
Path
, "logFile3.log")};verbosity=diagnostic -flp2:logfile={Path.Combine(logFolder.
Path
, "logFile4.log")};verbosity=normal", out success);
426
text = File.ReadAllText(Path.Combine(logFolder.
Path
, "logFile3.log"));
430
text2 = File.ReadAllText(Path.Combine(logFolder.
Path
, "logFile4.log"));
475
string symlinkPath = Path.Combine(testFolder2.
Path
, symlinkName);
476
string symlinkLvl2Path = Path.Combine(testFolder2.
Path
, symlinkLvl2Name);
562
string logFilePath = Path.Combine(_env.DefaultTestDirectory.
Path
, "test.binlog");
CLR2TaskHost_E2E_Tests.cs (1)
58
string projectPath = Path.Combine(testFolder.
Path
, "CLR2ExplicitTest.proj");
Construction\SolutionFile_OldParser_Tests.cs (3)
774
env.CreateFolder(Path.Combine(solutionFolder.
Path
, "RelativePath"));
777
p.FullPath = Path.Combine(solutionFolder.
Path
, "RelativePath", "project file");
778
p.SolutionFileDirectory = Path.GetFullPath(solutionFolder.
Path
);
Construction\SolutionFilter_Tests.cs (8)
53
TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "ClassLibrary"), createFolder: true);
54
TransientTestFolder classLibSubFolder = testEnvironment.CreateFolder(Path.Combine(classLibFolder.
Path
, "ClassLibrary"), createFolder: true);
63
TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "SimpleProject"), createFolder: true);
64
TransientTestFolder simpleProjectSubFolder = testEnvironment.CreateFolder(Path.Combine(simpleProjectFolder.
Path
, "SimpleProject"), createFolder: true);
231
TransientTestFolder src = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "src"), createFolder: true);
292
folder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, $"test@folder%special$symbols"), createFolder: true);
393
TransientTestFolder src = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "src"), createFolder: true);
394
TransientTestFolder nested = testEnvironment.CreateFolder(Path.Combine(src.
Path
, "nested"), createFolder: true);
Construction\SolutionProjectGenerator_Tests.cs (6)
121
TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "classlib"), createFolder: true);
131
TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "simpleProject"), createFolder: true);
166
TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "classlib"), createFolder: true);
182
TransientTestFolder simpleProjectFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "simpleProject"), createFolder: true);
241
TransientTestFolder classLibFolder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, "classlib"), createFolder: true);
257
TransientTestFolder 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 }
372
var projectDirectory = _env.DefaultTestDirectory.
Path
;
431
var projectDirectory1 = _env.DefaultTestDirectory.CreateDirectory("1").
Path
;
432
var projectDirectory2 = _env.DefaultTestDirectory.CreateDirectory("2").
Path
;
482
var project1Directory = project1Root.CreateDirectory("1").
Path
;
483
var project1GlobDirectory = project1Root.CreateDirectory("Glob").CreateDirectory("1").
Path
;
486
var project2Directory = project2Root.CreateDirectory("2").
Path
;
487
var project2GlobDirectory = project2Root.CreateDirectory("Glob").CreateDirectory("2").
Path
;
547
var project1GlobDirectory = project1Directory.CreateDirectory("Glob").CreateDirectory("1").
Path
;
562
Path.Combine(project1Directory.
Path
, "1"),
570
Path.Combine(project2Directory.
Path
, "2"),
573
<i Include=`{Path.Combine(project1Directory.
Path
, "Glob", "**", "*.cs")}` />
591
.Select(i => Path.Combine(project1Directory.
Path
, i))
622
File.WriteAllText(Path.Combine(globDirectory.
Path
, $"{evaluationCount}.cs"), "");
628
Path.Combine(project1Directory.
Path
, "1"),
635
Path.Combine(project2Directory.
Path
, "2"),
660
File.WriteAllText(Path.Combine(globDirectory.
Path
, $"{evaluationCount}.cs"), "");
687
: globDirectory.
Path
;
689
Directory.CreateDirectory(globDirectory.
Path
);
720
.Select((p, i) => new ProjectSpecification(Path.Combine(testDirectory.
Path
, $"ProjectDirectory{i}", $"Project{i}.proj"), p));
726
File.WriteAllText(Path.Combine(globDirectory.
Path
, $"{evaluationCount}.cs"), "");
736
File.WriteAllText(Path.Combine(globDirectory.
Path
, $"{evaluationCount}.cs"), "");
757
var projectDirectory = _env.DefaultTestDirectory.
Path
;
800
var projectDirectory = _env.DefaultTestDirectory.
Path
;
862
<SearchedPath>$([MSBuild]::GetDirectoryNameOfFileAbove('{subdirectory.
Path
}', 'a'))</SearchedPath>
876
searchedPath.EvaluatedValue.ShouldBe(subdirectory.
Path
);
882
? subdirectory.
Path
883
: _env.DefaultTestDirectory.
Path
);
918
<SearchedPath>$([MSBuild]::GetPathOfFileAbove('a', '{subdirectory.
Path
}'))</SearchedPath>
958
projectContents.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)
4914
includes.ShouldContain(root.
Path
);
4915
includes.ShouldContain(alpha.
Path
);
4916
includes.ShouldContain(beta.
Path
);
4917
includes.ShouldNotContain(gamma.
Path
);
4958
includes.ShouldContain(root.
Path
);
4959
includes.ShouldContain(alpha.
Path
);
4960
includes.ShouldContain(beta.
Path
);
4961
includes.ShouldContain(gamma.
Path
);
5377
File.WriteAllText(Path.Combine(correctDir.
Path
, "notes.txt"), "correct content");
5378
File.WriteAllText(Path.Combine(wrongDir.
Path
, "notes.txt"), "wrong content");
5381
"$([System.IO.File]::ReadAllText('notes.txt'))", correctDir.
Path
, wrongDir.
Path
);
5393
File.WriteAllText(Path.Combine(correctDir.
Path
, "exists.txt"), "data");
5397
"$([System.IO.File]::Exists('exists.txt'))", correctDir.
Path
, wrongDir.
Path
);
5409
string filePath = Path.Combine(correctDir.
Path
, "attrs.txt");
5414
correctDir.
Path
, wrongDir.
Path
);
5427
string filePath = Path.Combine(correctDir.
Path
, "time.txt");
5432
"$([System.IO.File]::GetCreationTime('time.txt'))", correctDir.
Path
, wrongDir.
Path
);
5444
string filePath = Path.Combine(correctDir.
Path
, "time.txt");
5449
"$([System.IO.File]::GetLastWriteTime('time.txt'))", correctDir.
Path
, wrongDir.
Path
);
5461
string filePath = Path.Combine(correctDir.
Path
, "time.txt");
5466
"$([System.IO.File]::GetLastAccessTime('time.txt'))", correctDir.
Path
, wrongDir.
Path
);
5482
Directory.CreateDirectory(Path.Combine(correctDir.
Path
, "subdir"));
5486
"$([System.IO.Directory]::Exists('subdir'))", correctDir.
Path
, wrongDir.
Path
);
5498
Directory.CreateDirectory(Path.Combine(correctDir.
Path
, "parent", "child"));
5501
@"$([System.IO.Directory]::GetParent('parent\child'))", correctDir.
Path
, wrongDir.
Path
);
5514
string subDir = Path.Combine(correctDir.
Path
, "sub");
5519
"$([System.IO.Directory]::GetFiles('sub'))", correctDir.
Path
, wrongDir.
Path
);
5532
Directory.CreateDirectory(Path.Combine(correctDir.
Path
, "parent", "child"));
5535
"$([System.IO.Directory]::GetDirectories('parent'))", correctDir.
Path
, wrongDir.
Path
);
5547
string subDir = Path.Combine(correctDir.
Path
, "sub");
5552
"$([System.IO.Directory]::GetLastWriteTime('sub'))", correctDir.
Path
, wrongDir.
Path
);
5564
string subDir = Path.Combine(correctDir.
Path
, "sub");
5569
"$([System.IO.Directory]::GetLastAccessTime('sub'))", correctDir.
Path
, wrongDir.
Path
);
5586
File.WriteAllText(Path.Combine(correctDir.
Path
, "lines.txt"), "line1\nline2");
5587
File.WriteAllText(Path.Combine(wrongDir.
Path
, "lines.txt"), "wrong");
5590
"$([System.IO.File]::ReadAllLines('lines.txt'))", correctDir.
Path
, wrongDir.
Path
);
5603
File.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
);
5622
File.Exists(Path.Combine(correctDir.
Path
, "output.txt")).ShouldBeTrue();
5623
File.ReadAllText(Path.Combine(correctDir.
Path
, "output.txt")).ShouldBe("hello");
5624
File.Exists(Path.Combine(wrongDir.
Path
, "output.txt")).ShouldBeFalse();
5635
File.WriteAllText(Path.Combine(correctDir.
Path
, "append.txt"), "base");
5638
"$([System.IO.File]::AppendAllText('append.txt', ' added'))", correctDir.
Path
, wrongDir.
Path
);
5640
File.ReadAllText(Path.Combine(correctDir.
Path
, "append.txt")).ShouldBe("base added");
5651
string correctFile = Path.Combine(correctDir.
Path
, "todelete.txt");
5652
string wrongFile = Path.Combine(wrongDir.
Path
, "todelete.txt");
5657
"$([System.IO.File]::Delete('todelete.txt'))", correctDir.
Path
, wrongDir.
Path
);
5671
string filePath = Path.Combine(correctDir.
Path
, "utc.txt");
5676
"$([System.IO.File]::GetCreationTimeUtc('utc.txt'))", correctDir.
Path
, wrongDir.
Path
);
5689
string filePath = Path.Combine(correctDir.
Path
, "utc.txt");
5694
"$([System.IO.File]::GetLastWriteTimeUtc('utc.txt'))", correctDir.
Path
, wrongDir.
Path
);
5707
string 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
);
5732
Directory.Exists(Path.Combine(correctDir.
Path
, "newdir")).ShouldBeTrue();
5733
Directory.Exists(Path.Combine(wrongDir.
Path
, "newdir")).ShouldBeFalse();
5744
Directory.CreateDirectory(Path.Combine(correctDir.
Path
, "todel"));
5745
Directory.CreateDirectory(Path.Combine(wrongDir.
Path
, "todel"));
5748
"$([System.IO.Directory]::Delete('todel'))", correctDir.
Path
, wrongDir.
Path
);
5750
Directory.Exists(Path.Combine(correctDir.
Path
, "todel")).ShouldBeFalse();
5751
Directory.Exists(Path.Combine(wrongDir.
Path
, "todel")).ShouldBeTrue();
5764
string filePath = Path.Combine(dir.
Path
, "abs.txt");
5780
string filePath = Path.Combine(dir.
Path
, "abs.txt");
5795
string subDir = Path.Combine(dir.
Path
, "subdir");
5815
string absFile = Path.Combine(otherDir.
Path
, "abs.txt");
5820
$"$([System.IO.File]::ReadAllText('{absFile}'))", correctDir.
Path
);
5832
string absFile = Path.Combine(otherDir.
Path
, "abs.txt");
5836
$"$([System.IO.File]::Exists('{absFile}'))", correctDir.
Path
);
5853
File.WriteAllText(Path.Combine(correctDir.
Path
, "source.txt"), "copy me");
5856
"$([System.IO.File]::Copy('source.txt', 'dest.txt'))", correctDir.
Path
, wrongDir.
Path
);
5858
File.Exists(Path.Combine(correctDir.
Path
, "dest.txt")).ShouldBeTrue();
5859
File.ReadAllText(Path.Combine(correctDir.
Path
, "dest.txt")).ShouldBe("copy me");
5860
File.Exists(Path.Combine(wrongDir.
Path
, "dest.txt")).ShouldBeFalse();
5871
File.WriteAllText(Path.Combine(correctDir.
Path
, "movesrc.txt"), "move me");
5874
"$([System.IO.File]::Move('movesrc.txt', 'movedst.txt'))", correctDir.
Path
, wrongDir.
Path
);
5876
File.Exists(Path.Combine(correctDir.
Path
, "movesrc.txt")).ShouldBeFalse();
5877
File.Exists(Path.Combine(correctDir.
Path
, "movedst.txt")).ShouldBeTrue();
5878
File.ReadAllText(Path.Combine(correctDir.
Path
, "movedst.txt")).ShouldBe("move me");
5889
Directory.CreateDirectory(Path.Combine(correctDir.
Path
, "dirsrc"));
5892
"$([System.IO.Directory]::Move('dirsrc', 'dirdst'))", correctDir.
Path
, wrongDir.
Path
);
5894
Directory.Exists(Path.Combine(correctDir.
Path
, "dirsrc")).ShouldBeFalse();
5895
Directory.Exists(Path.Combine(correctDir.
Path
, "dirdst")).ShouldBeTrue();
5910
string siblingDir = Path.Combine(rootDir.
Path
, "sibling");
5911
string subDir = Path.Combine(rootDir.
Path
, "subdir");
5917
@"$([System.IO.File]::ReadAllText('../sibling/file.txt'))", subDir, wrongDir.
Path
);
5933
string siblingDir = Path.Combine(rootDir.
Path
, "sibling");
5934
string subDir = Path.Combine(rootDir.
Path
, "subdir");
5941
@"$([System.IO.File]::ReadAllText('..\\sibling\\file.txt'))", subDir, wrongDir.
Path
);
Evaluation\IntrinsicFunctionOverload_Tests.cs (3)
133
string testFilePath = Path.Combine(env.DefaultTestDirectory.
Path
, "TestFile.txt");
173
string testDirPath = Path.Combine(env.DefaultTestDirectory.
Path
, "TestDir");
214
string testDirPath = Path.Combine(env.DefaultTestDirectory.
Path
, "TestDir");
Evaluation\Preprocessor_Tests.cs (4)
850
string testSdkDirectory = env.CreateFolder().
Path
;
941
string testDirectory = env.CreateFolder().
Path
;
1056
string sdk1 = env.CreateFolder().
Path
;
1057
string sdk2 = env.CreateFolder().
Path
;
Evaluation\ProjectSdkImplicitImport_Tests.cs (2)
88
_testSdkRoot = _env.CreateFolder().
Path
;
354
var projectFolder = _env.CreateFolder().
Path
;
Evaluation\SdkResultEvaluation_Tests.cs (1)
40
_testFolder = _env.CreateFolder().
Path
;
Graph\GetCompatiblePlatformGraph_Tests.cs (6)
354
TransientTestFolder project1Folder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, firstProjectName), createFolder: true);
355
TransientTestFolder project1SubFolder = testEnvironment.CreateFolder(Path.Combine(project1Folder.
Path
, firstProjectName), createFolder: true);
369
TransientTestFolder project2Folder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, secondProjectName), createFolder: true);
370
TransientTestFolder project2SubFolder = testEnvironment.CreateFolder(Path.Combine(project2Folder.
Path
, secondProjectName), createFolder: true);
380
TransientTestFolder project3Folder = testEnvironment.CreateFolder(Path.Combine(folder.
Path
, thirdProjectName), createFolder: true);
381
TransientTestFolder project3SubFolder = testEnvironment.CreateFolder(Path.Combine(project3Folder.
Path
, thirdProjectName), createFolder: true);
Graph\ProjectGraph_Tests.cs (8)
843
string project1Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project1.csproj");
844
string project2Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project2.vcxproj");
845
string project3Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project3.vcxproj");
846
string project4Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project4.vcxproj");
847
string project5Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project5.vcxproj");
848
string project6Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project6.wapproj");
849
string project7Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project7.csproj");
850
string project8Path = Path.Combine(env.DefaultTestDirectory.
Path
, "Project8.csproj");
MSBuildTaskHostTests.cs (2)
33
CopyFilesRecursively(Path.Combine(TestAssetsRootPath, "Net35WinFormsApp"), testFolder.
Path
);
34
string projectFilePath = Path.Combine(testFolder.
Path
, "TestNet35WinForms.csproj");
ProjectCache\ProjectCacheTests.cs (1)
1736
string appDllPath = Path.Combine(directory.
Path
, $"bin/{s_currentTargetNETFramework}/app.dll");
TerminalLogger_Tests.cs (2)
917
RunnerUtilities.ExecMSBuild($"{projectFile.Path} /bl:{logFileWithTL} -flp:logfile={Path.Combine(logFolder.
Path
, "logFileWithTL.log")};verbosity=diagnostic -tl:on", out bool success, outputHelper: _outputHelper);
921
RunnerUtilities.ExecMSBuild($"{projectFile.Path} /bl:{logFileWithoutTL} -flp:logfile={Path.Combine(logFolder.
Path
, "logFileWithoutTL.log")};verbosity=diagnostic", out success, outputHelper: _outputHelper);
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
TypeLoader_Tests.cs (2)
104
string newAssemblyLocation = Path.Combine(folder.
Path
, Path.GetFileName(currentAssembly));
109
File.Copy(utilities, Path.Combine(folder.
Path
, utilitiesName));
Microsoft.Build.Framework.UnitTests (12)
FileMatcher_Tests.cs (11)
64
File.WriteAllBytes(Path.Combine(testFolder.
Path
, file), new byte[1]);
67
string[] fileMatches = FileMatcher.Default.GetFiles(testFolder.
Path
, pattern).FileList;
78
TransientTestFolder tf2 = _env.CreateFolder(Path.Combine(testFolder.
Path
, "subfolder"));
79
string symlinkPath = Path.Combine(tf2.
Path
, "mySymlink");
82
Directory.CreateSymbolicLink(symlinkPath, testFolder.
Path
);
83
string[] fileMatches = FileMatcher.Default.GetFiles(testFolder.
Path
, "**").FileList;
103
foreach (string fullPath in GetFilesComplexGlobbingMatchingInfo.FilesToCreate.Select(i => Path.Combine(testFolder.
Path
, i.ToPlatformSlash())))
112
string[] matchedFiles = fileMatcher.GetFiles(testFolder.
Path
, include, excludes?.ToList()).FileList;
1248
string workingPath = _env.CreateFolder().
Path
;
1262
string workingPath = _env.CreateFolder().
Path
;
1279
string workingPath = _env.CreateFolder().
Path
;
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
Microsoft.Build.Tasks.UnitTests (104)
AddToWin32Manifest_Tests.cs (3)
43
var tempOutput = env.CreateFolder().
Path
;
81
var outputPath = env.CreateFolder().
Path
;
108
File.Copy(Path.Combine(TestAssetsRootPath, manifestName), Path.Combine(projectFolder.
Path
, manifestName));
Copy_Tests.cs (16)
173
DestinationFolder = new TaskItem(destinationFolder.
Path
),
216
SourceFolders = new ITaskItem[] { new TaskItem(s0Folder.
Path
), new TaskItem(s1Folder.
Path
) },
217
DestinationFolder = new TaskItem(destinationFolder.
Path
),
226
Directory.Exists(Path.Combine(destinationFolder.
Path
, "source0")).ShouldBeTrue();
227
Directory.Exists(Path.Combine(destinationFolder.
Path
, "source1")).ShouldBeTrue();
243
DestinationFolder = new TaskItem(destinationFolder.
Path
),
274
SourceFolders = new ITaskItem[] { new TaskItem(sourceFolder.
Path
) },
275
DestinationFolder = new TaskItem(destinationFolder.
Path
),
300
DestinationFolder = new TaskItem(destinationFolder.
Path
),
325
DestinationFolder = new TaskItem(destinationFolder.
Path
),
376
DestinationFolder = new TaskItem(destinationFolder.
Path
),
400
SourceFolders = new ITaskItem[] { new TaskItem(sourceFolder.
Path
) },
1120
var sourceFile = FileUtilities.GetTemporaryFile(env.DefaultTestDirectory.
Path
, null, "src", false);
1121
var destinationFile = FileUtilities.GetTemporaryFile(env.DefaultTestDirectory.
Path
, null, "dst", false);
3002
string destFile = Path.Combine(destFolder.
Path
, "The Destination");
CreateCSharpManifestResourceName_Tests.cs (1)
459
env.SetCurrentDirectory(env.DefaultTestDirectory.
Path
);
DownloadFile_Tests.cs (9)
38
DestinationFolder = new TaskItem(folder.
Path
),
68
DestinationFolder = new TaskItem(folder.
Path
),
79
FileInfo file = new FileInfo(Path.Combine(folder.
Path
, "foo.txt"));
117
DestinationFolder = new TaskItem(folder.
Path
),
125
FileInfo file = new FileInfo(Path.Combine(folder.
Path
, filename));
148
DestinationFolder = new TaskItem(folder.
Path
),
160
FileInfo file = new FileInfo(Path.Combine(folder.
Path
, filename));
216
DestinationFolder = new TaskItem(folder.
Path
),
332
DestinationFolder = new TaskItem(folder.
Path
),
GenerateBindingRedirects_Tests.cs (1)
267
TransientTestFolder testFolder = env.CreateFolder(Path.Combine(rootTestFolder.
Path
, "\uD873\uDD02\u9FA8\u82D8\u722B\u9EA4\u03C5\u33D1\uE038\u486B\u0033"));
GetSDKReference_Tests.cs (2)
276
GetSDKReferenceFiles.SDKFilesCache cache = new(null, folder.
Path
, null, null, null);
278
GetSDKReferenceFiles.SDKFilesCache cache2 = new(null, folder.
Path
, null, null, null);
HintPathResolver_Tests.cs (1)
44
var 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)
26
var outputPath = env.CreateFolder().
Path
;
71
var outputPath = env.CreateFolder().
Path
;
117
var outputPath = env.CreateFolder().
Path
;
195
var outputPath = env.CreateFolder().
Path
;
249
var outputPath = env.CreateFolder().
Path
;
PortableTasks_Tests.cs (1)
49
var folder = env.CreateFolder().
Path
;
RemoveDir_Tests.cs (1)
56
list.Add(new TaskItem(env.CreateFolder().
Path
));
ResolveAssemblyReference_CustomCultureTests.cs (2)
45
var solutionPath = solutionFolder.
Path
;
49
var projBOutputPath = env.CreateFolder().
Path
;
ResourceHandling\GenerateResource_Tests.cs (2)
3936
env.SetCurrentDirectory(env.DefaultTestDirectory.
Path
);
3942
env.CreateFolder(Path.Combine(env.DefaultTestDirectory.
Path
, "tmp_dir")),
ResourceHandling\MSBuildResXReader_Tests.cs (1)
178
Path.Combine(baseDir.
Path
, nameof(LoadsStringFromFileRefAsStringWithShiftJISEncoding) + ".resx"),
RoslynCodeTaskFactory_Tests.cs (9)
130
string output = RunnerUtilities.ExecMSBuild(assemblyProj.Path + $" /p:OutDir={Path.Combine(folder.
Path
, "subFolder")} /restore", out bool success);
138
<Reference Include=""{Path.Combine(folder.
Path
, "subFolder", "5106.dll")}"" />
1240
TransientTestFolder project1Folder = env.CreateFolder(Path.Combine(rootFolder.
Path
, "Project1"), createFolder: true);
1241
TransientTestFolder project2Folder = env.CreateFolder(Path.Combine(rootFolder.
Path
, "Project2"), createFolder: true);
1332
string projectFilePath = Path.Combine(testFolder.
Path
, "test.proj");
1382
string projectFilePath = Path.Combine(projectFolder.
Path
, "test.proj");
1427
TransientTestFolder projectFolder = env.CreateFolder(Path.Combine(rootFolder.
Path
, "Project"), createFolder: true);
1428
string projectFilePath = Path.Combine(projectFolder.
Path
, "test.proj");
1544
string projectFilePath = Path.Combine(testFolder.
Path
, "test.proj");
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
Unzip_Tests.cs (34)
38
DestinationFolder = new TaskItem(source.
Path
),
67
DestinationFolder = new TaskItem(destination.
Path
),
81
DestinationFolder = 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);
97
DestinationFolder = new TaskItem(destination.
Path
),
127
DestinationFolder = 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);
140
Directory.Exists(Path.Combine(destination.
Path
, "emptyDir"));
202
DestinationFolder = new TaskItem(source.
Path
),
227
DestinationFolder = new TaskItem(folder.
Path
),
248
DestinationFolder = new TaskItem(folder.
Path
),
249
SourceFiles = new ITaskItem[] { new TaskItem(Path.Combine(testEnvironment.DefaultTestDirectory.
Path
, "foo.zip")), },
274
DestinationFolder = new TaskItem(destination.
Path
),
284
_mockEngine.Log.ShouldContain(Path.Combine(destination.
Path
, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log);
285
_mockEngine.Log.ShouldNotContain(Path.Combine(destination.
Path
, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log);
304
DestinationFolder = new TaskItem(destination.
Path
),
314
_mockEngine.Log.ShouldNotContain(Path.Combine(destination.
Path
, "BE78A17D30144B549D21F71D5C633F7D.txt"), customMessage: _mockEngine.Log);
315
_mockEngine.Log.ShouldContain(Path.Combine(destination.
Path
, "A04FF4B88DF14860B7C73A8E75A4FB76.txt"), customMessage: _mockEngine.Log);
338
DestinationFolder = new TaskItem(destination.
Path
),
349
_mockEngine.Log.ShouldContain(Path.Combine(destination.
Path
, "file1.js"), customMessage: _mockEngine.Log);
350
_mockEngine.Log.ShouldNotContain(Path.Combine(destination.
Path
, "file1.js.map"), customMessage: _mockEngine.Log);
351
_mockEngine.Log.ShouldContain(Path.Combine(destination.
Path
, "file2.js"), customMessage: _mockEngine.Log);
352
_mockEngine.Log.ShouldNotContain(Path.Combine(destination.
Path
, "readme.txt"), customMessage: _mockEngine.Log);
353
_mockEngine.Log.ShouldNotContain(Path.Combine(destination.
Path
, "sub", "subfile.js"), customMessage: _mockEngine.Log);
372
DestinationFolder = new TaskItem(destination.
Path
),
401
DestinationFolder = new TaskItem(destination.
Path
),
430
DestinationFolder = new TaskItem(destination.
Path
),
459
DestinationFolder = new TaskItem(destination.
Path
),
494
DestinationFolder = new TaskItem(destination.
Path
),
501
string unzippedFilePath = Path.Combine(destination.
Path
, executableName);
WriteCodeFragment_Tests.cs (4)
109
TaskItem folder = new TaskItem(env.CreateFolder(folderPath: null, createFolder: false).
Path
);
132
TaskItem file = new TaskItem(Path.Combine(env.CreateFolder(folderPath: null, createFolder: false).
Path
, "File.tmp"));
411
TaskItem folder = new TaskItem(env.CreateFolder(folderPath: null, createFolder: false).
Path
);
433
string absoluteFolder = env.CreateFolder().
Path
;
WriteLinesToFile_Tests.cs (5)
319
var file = Path.Combine(directory.
Path
, $"{Guid.NewGuid().ToString("N")}.tmp");
330
Directory.Exists(directory.
Path
).ShouldBeFalse();
334
Directory.Exists(directory.
Path
).ShouldBeTrue();
398
var outputFile = Path.Combine(testEnv.DefaultTestDirectory.
Path
, "output.txt");
459
var outputFile = Path.Combine(testEnv.DefaultTestDirectory.
Path
, "output.txt");
ZipDirectory_Tests.cs (6)
47
string zipFilePath = Path.Combine(testEnvironment.CreateFolder(createFolder: true).
Path
, "test.zip");
54
SourceDirectory = new TaskItem(sourceFolder.
Path
),
60
_mockEngine.Log.ShouldContain(sourceFolder.
Path
, customMessage: _mockEngine.Log);
113
SourceDirectory = new TaskItem(sourceFolder.
Path
),
119
_mockEngine.Log.ShouldContain(sourceFolder.
Path
, customMessage: _mockEngine.Log);
151
SourceDirectory = new TaskItem(folder.
Path
),
Microsoft.Build.UnitTests.Shared (20)
EngineTestEnvironment.cs (1)
113
public string TestRoot => _folder.
Path
;
TestEnvironment.cs (19)
202
return SetTempPath(folder.
Path
, true);
211
return WithTransientTestState(SetTempPath(folder.
Path
, true));
242
return WithTransientTestState(new TransientTestFile(transientTestFolder.
Path
, fileName, contents));
253
return WithTransientTestState(new TransientTestFile(transientTestFolder.
Path
, extension,
276
return WithTransientTestState(new TransientTestFile(transientTestFolder.
Path
, extension,
309
Assert.True(!(createFolder ^ FileSystems.Default.DirectoryExists(folder.
Path
)));
785
Directory.CreateDirectory(
Path
);
791
return new TransientTestFolder(System.IO.Path.Combine(
Path
, directoryName));
796
return new TransientTestFile(
Path
, fileName, contents);
805
Path
.ShouldNotBeNullOrEmpty();
806
Path
.ShouldNotBe(@"\");
807
Path
.ShouldNotBe(@"/");
808
System.IO.Path.GetFullPath(
Path
).ShouldNotBe(System.IO.Path.GetFullPath(System.IO.Path.GetTempPath()));
809
System.IO.Path.IsPathRooted(
Path
).ShouldBeTrue($"{
Path
} is not rooted");
811
FileUtilities.DeleteDirectoryNoThrow(
Path
, true);
861
Directory.CreateDirectory(destination.
Path
);
863
string path = System.IO.Path.Combine(destination.
Path
, filename);
865
ZipFile.CreateFromDirectory(source.
Path
, path);
Microsoft.Build.Utilities.UnitTests (18)
TestAssemblyInfo.cs (1)
231
_testEnvironment.SetTempPath(assemblyTempFolder.
Path
);
ToolLocationHelper_Tests.cs (12)
2500
string rootDir = Path.Combine(env.DefaultTestDirectory.
Path
, "framework-root");
2529
string customFrameworkRootPath = Path.Combine(env.DefaultTestDirectory.
Path
, "framework-root");
2552
string rootDir = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2553
string fallbackPath = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2583
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2596
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2598
string rootDir = env.CreateFolder().
Path
;
2613
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2630
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2645
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
2647
string rootDir = env.CreateFolder().
Path
;
2662
string customFrameworkDirToUse = Path.Combine(env.CreateFolder().
Path
, "framework-root");
ToolTask_Tests.cs (5)
727
string tempDirectory = env.CreateFolder().
Path
;
1457
string tempDir = env.CreateFolder().
Path
;
1487
string projectDir = env.CreateFolder().
Path
;
1559
string projectDir = env.CreateFolder().
Path
;
1560
string toolDir = env.CreateFolder().
Path
;