Fix xUnit test GetTempFileName (#6943)

Use Path.GetTempFileName() to get a temporary file.
This commit is contained in:
Ilya 2018-05-31 11:03:14 +05:00 committed by GitHub
parent c297eac50e
commit a5f77955e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ namespace PSTests.Parallel
private string testContent; private string testContent;
public FileSystemProviderTests() public FileSystemProviderTests()
{ {
testPath = Path.Combine(Path.GetTempPath(),"test"); testPath = Path.GetTempFileName();
testContent = "test content!"; testContent = "test content!";
if(File.Exists(testPath)) File.Delete(testPath); if(File.Exists(testPath)) File.Delete(testPath);
File.AppendAllText(testPath,testContent); File.AppendAllText(testPath,testContent);
@ -138,9 +138,9 @@ namespace PSTests.Parallel
PSObject psobject1=PSObject.AsPSObject(fileSystemObject1); PSObject psobject1=PSObject.AsPSObject(fileSystemObject1);
foreach(PSPropertyInfo property in psobject1.Properties) foreach(PSPropertyInfo property in psobject1.Properties)
{ {
if(property.Name == "Name") if(property.Name == "FullName")
{ {
Assert.Equal("test", property.Value); Assert.Equal(testPath, property.Value);
} }
} }
} }