mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix xUnit test GetTempFileName (#6943)
Use Path.GetTempFileName() to get a temporary file.
This commit is contained in:
@@ -25,7 +25,7 @@ namespace PSTests.Parallel
|
||||
private string testContent;
|
||||
public FileSystemProviderTests()
|
||||
{
|
||||
testPath = Path.Combine(Path.GetTempPath(),"test");
|
||||
testPath = Path.GetTempFileName();
|
||||
testContent = "test content!";
|
||||
if(File.Exists(testPath)) File.Delete(testPath);
|
||||
File.AppendAllText(testPath,testContent);
|
||||
@@ -138,9 +138,9 @@ namespace PSTests.Parallel
|
||||
PSObject psobject1=PSObject.AsPSObject(fileSystemObject1);
|
||||
foreach(PSPropertyInfo property in psobject1.Properties)
|
||||
{
|
||||
if(property.Name == "Name")
|
||||
if(property.Name == "FullName")
|
||||
{
|
||||
Assert.Equal("test", property.Value);
|
||||
Assert.Equal(testPath, property.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user